T.Tool = T.Kr.extend({
    includes: T.iQ.OQ
}),
    T.drawVersion = "4.0",
    T.Tool = T.Kr.extend({
        includes: T.iQ.OQ
    }),
    T.aO = {},
    T.aO.Feature = T.Tool.extend({
        includes: T.iQ.OQ,
        initialize: function(t, i) {
            this.jE = t,
                this.Ow = t.Ow,
                this.SO = t.aw.overlayPane,
            i && i.sO && (i.sO = T.S.extend({},
                this.options.sO, i.sO)),
                T.setOptions(this, i)
        },
        enable: function() {
            this.eU || (this.wQ("aE", {
                handler: this.type
            }), this.jE.wQ("draw:drawstart", {
                layerType: this.type
            }), T.Tool.prototype.enable.call(this))
        },
        disable: function() {
            this.eU && (T.Tool.prototype.disable.call(this), this.jE.wQ("draw:drawstop", {
                layerType: this.type
            }), this.wQ("disabled", {
                handler: this.type
            }))
        },
        oU: function() {
            var t = this.jE;
            t && (T._Q.Oq(), T.oq.on(this.Ow, "keyup", this.DO, this))
        },
        Ar: function() {
            this.jE && (T._Q.Pq(), T.oq.off(this.Ow, "keyup", this.DO, this))
        },
        setOptions: function(t) {
            T.setOptions(this, t)
        },
        dO: function(t) {
            this.jE.wQ("draw:created", {
                layer: t,
                layerType: this.type
            })
        },
        DO: function(t) {
            27 === t.keyCode && this.disable()
        }
    }),
    T.aO.Polyline = T.aO.Feature.extend({
        v: {
            TYPE: "polyline",
            FO: 1e3
        },
        Poly: T.Polyline,
        options: {
            fO: !0,
            GO: !1,
            gO: {
                color: "#b00b00",
                eO: 2500
            },
            icon: new T.DivIcon({
                iconSize: [11, 11]
            }),
            HO: 5,
            hO: 4e3,
            sO: {
                stroke: !0,
                color: "#0000FF",
                weight: 3,
                opacity: .5,
                fill: !1,
                JO: !0
            },
            KI: !0,
            jO: !0,
            zIndexOffset: 2e3
        },
        initialize: function(t, i) {
            i && i.gO && (i.gO = T.S.extend({},
                this.options.gO, i.gO)),
                this.type = T.aO.Polyline.TYPE,
                T.aO.Feature.prototype.initialize.call(this, t, i)
        },
        oU: function() {
            if (this.KO = !0, this.kO = this.jE.bU.eU, this.jE.disableDoubleClickZoom(), T.aO.Feature.prototype.oU.call(this), this.jE) {
                this.LO = [],
                this.lO || (this.lO = new T.fT),
                    this.jE.addLayer(this.lO);
                var t = this.lO,
                    i = this.jE;
                this.jE.on("layerremove",
                    function(e) {
                        t && t.hasLayer(e.layer) && (t.removeLayer(e.layer), e.layer.ZO && (e.layer.ZO.bE(function(t) {
                            t.label && t.label.onRemove(i)
                        }), e.layer.ZO.clearLayers(), e.layer.ZO.Qq()))
                    }),
                    this.ZO = new T.LayerGroup,
                    this.jE.addLayer(this.ZO),
                    this.CO = new this.Poly([], this.options.sO),
                this.VO || (this.VO = T.kr(this.jE.getCenter(), {
                    icon: T.Lr({
                        className: "tdt-mouse-marker",
                        iconAnchor: [20, 20],
                        iconSize: [40, 40]
                    }),
                    opacity: 0,
                    zIndexOffset: 6e3
                })),
                    !T.oQ.ie && T.oQ.touch && T.oQ.mobile ? (this.jE.on("touchstart", this._ontouchstart, this), this.jE.on("longpress", this._onlongpress, this), this.jE.on("touchend", this._ontouchend, this), this.jE.on("move", this._onmoveStart, this), this.jE.on("moveend", this._onmoveEnd, this)) : (this.VO.on("mousedown", this.nu, this).addTo(this.jE), this.jE.on("mousemove", this.PY, this), this.jE.on("mouseup", this.cO, this), this.jE.on("dblclick ", this.BO, this)),
                    this.jE.on("zoomend", this.hU, this)
            }
        },
        Ar: function() {
            T.aO.Feature.prototype.Ar.call(this),
                !T.oQ.ie && T.oQ.touch && T.oQ.mobile ? (this.jE.off("touchstart", this._ontouchstart, this), this.jE.off("longpress", this._onlongpress, this), this.jE.off("touchend", this._ontouchend, this), this.jE.off("move", this._onmoveStart, this), this.jE.off("moveend", this._onmoveEnd, this)) : (this.VO && (this.VO.off("mousedown", this.nu, this), this.VO.off("mouseup", this.mu, this), this.jE.removeLayer(this.VO), delete this.VO), this.jE.off("mousemove", this.PY, this), this.jE.off("zoomend", this.hU, this), this.vO()),
                this.jE.removeLayer(this.CO),
                delete this.CO,
            this.kO && this.jE.enableDoubleClickZoom()
        },
        NO: function(t) {
            var i = this.jE;
            this.lO && this.lO.hasLayer(t.layer) && (this.lO.removeLayer(t.layer), t.layer.ZO && (t.layer.ZO.bE(function(t) {
                t.label && t.label.onRemove(i)
            }), t.layer.ZO.clearLayers(), t.layer.ZO.Qq()))
        },
        bO: function() {
            if (! (this.LO.length <= 1)) {
                var t = this.LO.pop(),
                    i = this.CO,
                    e = this.CO.MO(i.Ht().length - 1, 1)[0];
                this.ZO.removeLayer(t),
                (i instanceof T.Polygon && i.Ht() && i.Ht()[0] && i.Ht()[0].length < 2 || i.Ht().length < 2) && this.jE.removeLayer(i),
                    this.nO(e, !1)
            }
        },
        _O: function(t) {
            this.LO.length;
            poly = this.CO,
                this.LO.push(this.mO(t)),
                poly.Zt(t),
            (poly instanceof T.Polygon && poly.Ht() && poly.Ht()[0] && 2 == poly.Ht()[0].length || 2 == poly.Ht().length) && this.jE.addLayer(this.CO),
                this.nO(t, !0)
        },
        Qo: function() {
            if (this.CO) {
                if (this.CO instanceof T.Polygon) var t = this.CO.Ht()[0][0];
                else t = this.CO.Ht()[0];
                var i = this.CO.qo(t, !0);
                if (!this.options.fO && i || !this.Wo()) return this.disable(),
                    void(this._mouselabel && this._mouselabel.Qq());
                this.dO(),
                    this.disable()
            }
        },
        Wo: function() {
            return ! 0
        },
        hU: function() {
            this.wo()
        },
        PY: function(t) {
            var i = (t.layerPoint, t.lnglat);
            this.Eo = i,
                this.wo(i),
                this.VO.sr(i),
            this._mouselabel && this._mouselabel.sr && this._mouselabel.sr(i),
                T.oq.preventDefault(t.originalEvent)
        },
        nO: function(t, i) {
            this.eo(),
                this.Ro(t, i),
                this.vO()
        },
        _ontouchstart: function(t) {
            this.ro = t.containerPoint
        },
        _onlongpress: function(t) {
            this.ismoving || (this.mu(t), this.endDraw())
        },
        _ontouchend: function(t) {
            this.mu(t)
        },
        _onmoveStart: function(t) {
            this._moveStartCenter = this.jE.getCenter(),
                this.ismoving = !0
        },
        _onmoveEnd: function(t) {
            var i = this,
                e = this.jE.getCenter(),
                s = this.jE.lngLatToContainerPoint(this._moveStartCenter),
                n = this.jE.lngLatToContainerPoint(e),
                o = s.sQ(n);
            setTimeout(function() {
                    o.x < 10 && o.y < 10 && (i.ismoving = !1)
                },
                301)
        },
        nu: function(t) {
            this.vO();
            var i = t.originalEvent;
            this.ro = T.SQ(i.clientX, i.clientY)
        },
        mu: function(t) {
            if (this.CO) if (this.ro) {
                var i = T.SQ(t.containerPoint.x, t.containerPoint.y);
                t.To || (t.To = i ? i: t.containerPoint);
                var e = t.To.distanceTo(this.ro);
                Math.abs(e) < 9 * (window.PQ || 1) && this._O(t.lnglat),
                    this.ro = null
            } else this.ro = t.containerPoint
        },
        eo: function() {
            this.LO.length
        },
        mO: function(t) {
            var i = new T.Marker(t, {
                icon: this.options.icon,
                zIndexOffset: T.aO.Polyline.FO++
            });
            return this.to ? i.setOpacity(1) : i.setOpacity(0),
                this.ZO.addLayer(i),
                i
        },
        Yo: function(t) {
            var i = {};
            for (var e in t) i[e] = "object" == typeof t[e] ? this.Yo(t[e]) : t[e];
            return i
        },
        wo: function(t) {
            if (t) {
                var i = this.LO.length;
                this.Uo || (this.Uo = new T.LayerGroup, this.jE.addLayer(this.Uo));
                var e = this.Yo(this.options.sO);
                if (e.lineStyle = "dashed", i > 0) {
                    if (t = t || this.Eo, this.Uo.getLayers().length < 1) {
                        var s = new T.Polyline([this.LO[i - 1].PE(), t], e);
                        this.Uo.addLayer(s)
                    } else this.Uo.getLayers()[0].Jt([this.LO[i - 1].PE(), t]);
                    if (this.CO instanceof T.Polygon && i > 1) if (this.Uo.getLayers().length < 2) {
                        var s = new T.Polyline([this.LO[0].PE(), t], e);
                        this.Uo.addLayer(s)
                    } else this.Uo.getLayers()[1].Jt([this.LO[0].PE(), t])
                }
            }
        },
        vO: function() {
            if (this.uo) for (; this.uo.firstChild;) this.uo.removeChild(this.uo.firstChild);
            this.Uo && this.Uo.getLayers().length > 0 && this.Uo.clearLayers()
        },
        Io: function(t, i) {
            var e, s, n, o = Math.floor(Math.sqrt(Math.pow(i.x - t.x, 2) + Math.pow(i.y - t.y, 2))),
                h = this.options.HO,
                r = this.options.hO,
                a = o > r ? o - r: h;
            for (this.uo || (this.uo = T._Q.s("div", "tdt-draw-guides", this.SO)); a < o; a += this.options.HO) e = a / o,
                s = {
                    x: Math.floor(t.x * (1 - e) + e * i.x),
                    y: Math.floor(t.y * (1 - e) + e * i.y)
                },
                n = T._Q.s("div", "tdt-draw-guide-dash", this.uo),
                n.style.backgroundColor = this.options.sO.color,
                T._Q.setPosition(n, s)
        },
        Ro: function(t, i) {
            var e, s, n = this.LO.length;
            1 === this.LO.length ? this.io = 0 : (e = n - (i ? 2 : 1), s = t.distanceTo(this.LO[e].PE()), this.io += s * (i ? 1 : -1))
        },
        Oo: function() {
            var t, i = this.Eo,
                e = this.LO[this.LO.length - 1].PE();
            return t = this.io + i.distanceTo(e),
                T.Po.oo(t, this.options.KI)
        },
        po: function() {
            this.Ao && (clearTimeout(this.Ao), this.Ao = null)
        },
        ao: function() {
            this.LO.length > 1 && this.LO[this.LO.length - 1].off("click", this.Qo, this)
        },
        dO: function() {
            var t = new this.Poly(this.CO.Ht(), this.options.sO);
            T.aO.Feature.prototype.dO.call(this, t),
                this.KO = !1
        }
    }),
    T.aO.Polygon = T.aO.Polyline.extend({
        v: {
            TYPE: "polygon"
        },
        Poly: T.Polygon,
        options: {
            So: !1,
            sO: {
                stroke: !0,
                color: "#0000FF",
                weight: 3,
                opacity: .5,
                fill: !0,
                fillColor: "#0000FF",
                fillOpacity: .2,
                JO: !0
            }
        },
        initialize: function(t, i) {
            T.aO.Polyline.prototype.initialize.call(this, t, i),
                this.type = T.aO.Polygon.TYPE
        },
        oU: function() {
            T.aO.Feature.prototype.oU.call(this),
            this.jE && (this.LO = [], this.ZO = new T.LayerGroup, this.jE.addLayer(this.ZO), this.CO = new T.Polygon([], this.options.sO), this.VO || (this.VO = T.kr(this.jE.getCenter(), {
                icon: T.Lr({
                    className: "tdt-mouse-marker",
                    iconAnchor: [20, 20],
                    iconSize: [40, 40]
                }),
                opacity: 0,
                zIndexOffset: 6001
            })), !T.oQ.ie && T.oQ.touch && T.oQ.mobile ? (this.jE.on("touchstart", this._ontouchstart, this), this.jE.on("longpress", this._onlongpress, this), this.jE.on("touchend", this._ontouchend, this), this.jE.on("move", this._onmoveStart, this), this.jE.on("moveend", this._onmoveEnd, this)) : (this.VO.on("mousedown", this.nu, this).addTo(this.jE), this.jE.on("mousemove", this.PY, this).on("zoomend", this.hU, this), this.jE.on("mouseup", this.cO, this), this.jE.on("dblclick ", this.BO, this)))
        },
        eo: function() {
            this.LO.length
        },
        Oo: function() {
            var t = this.so;
            return t ? T.Po.Do(t, this.options.KI) : null
        },
        Wo: function() {
            return this.LO.length >= 3
        },
        nO: function(t, i) {
            var e; ! this.options.fO && this.options.So && (e = this.CO.Ht(), this.so = T.Po.Fo(e)),
                T.aO.Polyline.prototype.nO.call(this, t, i)
        },
        ao: function() {
            var t = this.LO.length;
            t > 0 && (this.LO[0].off("click", this.Qo, this), t > 2 && this.LO[t - 1].off("dblclick", this.Qo, this))
        }
    }),
    T.aO.fo = T.aO.Feature.extend({
        options: {
            GO: !1
        },
        initialize: function(t, i) {
            T.aO.Feature.prototype.initialize.call(this, t, i)
        },
        oU: function() {
            T.aO.Feature.prototype.oU.call(this),
            this.jE && (this.Go = this.jE.AE.aE(), this.Go && this.jE.AE.disable(), this.Ow.style.cursor = "crosshair", this.jE.on("mousedown", this.nu, this).on("mousemove", this.PY, this))
        },
        Ar: function() {
            T.aO.Feature.prototype.Ar.call(this),
            this.jE && (this.Go && this.jE.AE.enable(), this.Ow.style.cursor = "", this.jE.off("mousedown", this.nu, this).off("mousemove", this.PY, this), T.oq.off(document, "mouseup", this.mu, this), this.go && (this.jE.removeLayer(this.go), delete this.go)),
                this.Ho = !1
        },
        nu: function(t) {
            this.Ho = !0,
                this.lu = t.lnglat,
                T.oq.on(document, "mouseup", this.mu, this).preventDefault(t.originalEvent)
        },
        PY: function(t) {
            var i = t.lnglat;
            this.Ho && this.ho(i)
        },
        mu: function() {
            this.go && this.dO(),
                this.disable(),
            this.options.GO && this.enable()
        }
    }),
    T.aO.Rectangle = T.aO.fo.extend({
        v: {
            TYPE: "rectangle"
        },
        options: {
            sO: {
                stroke: !0,
                color: "#0000FF",
                weight: 3,
                opacity: .5,
                fill: !0,
                fillColor: "#0000FF",
                fillOpacity: .2,
                JO: !0
            }
        },
        initialize: function(t, i) {
            this.type = T.aO.Rectangle.TYPE,
                T.aO.fo.prototype.initialize.call(this, t, i)
        },
        ho: function(t) {
            this.go ? this.go.setBounds(new T.Kq(this.lu, t)) : (this.go = new T.Rectangle(new T.Kq(this.lu, t), this.options.sO), this.jE.addLayer(this.go))
        },
        dO: function() {
            var t = new T.Rectangle(this.go.getBounds(), this.options.sO);
            T.aO.fo.prototype.dO.call(this, t)
        }
    }),
    T.aO.Circle = T.aO.fo.extend({
        v: {
            TYPE: "circle"
        },
        options: {
            sO: {
                stroke: !0,
                color: "#0000FF",
                weight: 3,
                opacity: .5,
                fill: !0,
                fillColor: "#0000FF",
                fillOpacity: .2,
                JO: !0
            },
            showRadius: !0,
            KI: !0
        },
        initialize: function(t, i) {
            this.type = T.aO.Circle.TYPE,
                T.aO.fo.prototype.initialize.call(this, t, i)
        },
        ho: function(t) {
            this.go ? this.go.setRadius(this.lu.distanceTo(t)) : (this.go = new T.Circle(this.lu, this.lu.distanceTo(t), this.options.sO), this.jE.addLayer(this.go))
        },
        dO: function() {
            var t = new T.Circle(this.lu, this.go.getRadius(), this.options.sO);
            T.aO.fo.prototype.dO.call(this, t)
        },
        PY: function(t) {
            var i, e = t.lnglat;
            this.options.showRadius,
                this.options.KI;
            this.Ho && (this.ho(e), i = this.go.getRadius().toFixed(1))
        }
    }),
    T.Icon.DrawDefault = T.Icon.extend({
        options: {
            iconSize: [25, 41],
            iconAnchor: [11, 40],
            popupAnchor: [1, -41],
            shadowSize: [41, 41]
        },
        tr: function(t) {
            var i = t + "Url";
            if (this.options[i]) return this.options[i];
            var e = T.Icon.Default.imagePath;
            return e + "/marker-" + t + (T.oQ.retina && "icon" === t ? "-2x": "") + ".png"
        }
    }),
    T.aO.Marker = T.aO.Feature.extend({
        v: {
            TYPE: "marker"
        },
        options: {
            icon: new T.Icon.DrawDefault,
            GO: !1,
            zIndexOffset: 2e3
        },
        initialize: function(t, i) {
            this.type = T.aO.Marker.TYPE,
                T.aO.Feature.prototype.initialize.call(this, t, i)
        },
        oU: function() {
            if (T.aO.Feature.prototype.oU.call(this), this.jE.getContainer().style.cursor = "pointer", this.jE) if (!T.oQ.ie && T.oQ.touch && T.oQ.mobile) this.jE.on("touchend", this.pY, this);
            else {
                if (!this.VO) {
                    var t = T.Lr({
                        className: ".tdt-mouse-marker-m",
                        iconAnchor: [20, 20],
                        iconSize: [40, 40]
                    });
                    this.VO = T.kr(this.jE.getCenter(), {
                        icon: t,
                        opacity: 0,
                        zIndexOffset: this.options.zIndexOffset
                    })
                }
                this.VO.on("click", this.pY, this).addTo(this.jE),
                    this._mouselabel = new T.Label({
                        text: this.text ? this.text: "点击标注",
                        position: new T.dq( - 1e4, -1e4),
                        Jo: [20, -9],
                        className: "tdt-label-m ",
                        zIndex: 4999
                    }).addTo(this.jE),
                    this.jE.on("mousemove", this.PY, this)
            }
        },
        Ar: function() {
            T.aO.Feature.prototype.Ar.call(this),
            this.jE && (T.oQ.touch && T.oQ.mobile ? this.jE.off("touchend", this.pY, this) : (this.jE.getContainer().style.cursor = "", this._mouselabel.Qq(), this.II && (this.II.off("click", this.pY, this), this.jE.off("click", this.pY, this).removeLayer(this.II), delete this.II), this.VO.off("click", this.pY, this), this.jE.removeLayer(this.VO), delete this.VO, this.jE.off("mousemove", this.PY, this)))
        },
        PY: function(t) {
            var i = t.lnglat;
            this.VO.sr(i),
            !T.oQ.ie && T.oQ.touch && T.oQ.mobile || this._mouselabel.sr(i),
                this.II ? (i = this.VO.PE(), this.II.sr(i)) : (this.II = new T.Marker(i, {
                    icon: this.options.icon,
                    zIndexOffset: this.options.zIndexOffset - 1
                }), this.II.on("click", this.pY, this), this.II.setOpacity(0), this.jE.on("click", this.pY, this).addLayer(this.II)),
            this.follow && this.II.setOpacity(1)
        },
        pY: function(t) {
            this.dO(t),
                this.disable()
        },
        dO: function(t) {
            var i = new T.Marker(this.II.PE(), {
                icon: this.options.icon
            });
            T.aO.Feature.prototype.dO.call(this, i)
        }
    }),
    T.jo = T.jo || {},
    T.jo.Poly = T.Tool.extend({
        options: {
            icon: new T.DivIcon({
                iconSize: [11, 11],
                className: "tdt-div-icon-black tdt-editing-icon"
            })
        },
        initialize: function(t, i) {
            this.CO = t,
                T.setOptions(this, i),
                this.Ko = T.Polygon && this.CO instanceof T.Polygon
        },
        oU: function() {
            this.CO.jE && (this.ZO || this.ko(), this.CO.jE.addLayer(this.ZO))
        },
        Ar: function() {
            this.CO.jE && (this.CO.jE.removeLayer(this.ZO), delete this.ZO, delete this.LO)
        },
        Lo: function() {
            this.ZO.clearLayers(),
                this.ko()
        },
        ko: function() {
            this.ZO || (this.ZO = new T.LayerGroup),
                this.LO = [];
            var t, i, e, s, n = this.CO.ht;
            for (this.Ko && (n = n[0]), t = 0, e = n.length; t < e; t++) s = this.mO(n[t], t),
                this.LO.push(s);
            var o, h;
            for (t = 0, i = e - 1; t < e; i = t++)(0 !== t || T.Polygon && this.CO instanceof T.Polygon) && (o = this.LO[i], h = this.LO[t], this.lo(o, h), this.Zo(o, h))
        },
        _createMidMarker: function(t, i, e) {
            var s = new T.DivIcon({
                    iconSize: [11, 11],
                    className: e + " tdt-editing-icon"
                }),
                n = new T.Marker(t, {
                    draggable: !0,
                    icon: s
                });
            return n.Co = t,
                n.Vo = i,
                n.on("drag", this.co, this),
                n.on("dragend", this.Bo, this),
                this.ZO.addLayer(n),
                n
        },
        mO: function(t, i, e) {
            var s = e ? new T.DivIcon({
                    iconSize: [11, 11],
                    className: e + " tdt-editing-icon"
                }) : this.options.icon,
                n = new T.Marker(t, {
                    draggable: !0,
                    icon: s
                });
            return n.Co = t,
                n.Vo = i,
                n.on("drag", this.co, this),
                n.on("dragend", this.Bo, this),
                this.ZO.addLayer(n),
                n
        },
        vo: function(t) {
            var i = t.Vo;
            this.ZO.removeLayer(t),
                this.LO.splice(i, 1),
                this.CO.MO(i, 1),
                this.No(i, -1),
                t.off("drag", this.co, this).off("dragend", this.Bo, this)
        },
        Bo: function(t) {
            var i = t.target;
            i.setIcon(this.options.icon),
                this.CO.edited = !0,
                this.CO.wQ("edit"),
                this.vO(),
                this.CO.redraw()
        },
        co: function(t) {
            var i = t.target;
            T.extend(i.Co, i.or),
            i.bo && i.bo.sr(this.Mo(i.no, i)),
            i._o && i._o.sr(this.Mo(i, i.mo));
            var e = [];
            if (i.bo || i._o) {
                for (var s = 0,
                         n = this.CO instanceof T.Polygon ? this.CO.Ht()[0] : this.CO.Ht(); s < n.length && !n[s].equals(i.PE()); s++);
                var o = s - 1 < 0 ? 0 : s - 1,
                    t = s + 2 > n.length ? n.length: s + 2;
                e = n.slice(o, t),
                this.CO instanceof T.Polygon && 2 == e.length && (0 == o ? e.splice(0, 0, n[n.length - 1]) : n.length == t && e.splice(n.length - 1, n.length - 1, n[0]))
            } else {
                for (var h, r, a = 0; a < this.ZO.getLayers().length; a++) this.ZO.getLayers()[a].bo === i && (h = this.ZO.getLayers()[a]),
                this.ZO.getLayers()[a]._o === i && (r = this.ZO.getLayers()[a]);
                e = [h.PE(), i.PE(), r.PE()]
            }
            this.wo(e)
        },
        Yo: function(t) {
            var i = {};
            for (var e in t) i[e] = "object" == typeof t[e] ? this.Yo(t[e]) : t[e];
            return i
        },
        wo: function(t) {
            if (this._guideLine) this._guideLine.Jt(t);
            else {
                var i = {};
                i.color = this.CO.options.color,
                    i.lineStyle = "dashed",
                    i.weight = this.CO.options.weight,
                    this._guideLine = new T.Polyline(t, i),
                    this.CO.jE.addLayer(this._guideLine)
            }
        },
        vO: function() {
            this._guideLine && (this._guideLine.Jt([]), this._guideLine.redraw())
        },
        QP: function(t) {
            var i = this.Ko,
                e = i ? 4 : 3,
                s = t.target; (i ? this.CO.ht[0] : this.CO.ht).length < e || (this.vo(s), this.Zo(s.no, s.mo), s.bo && this.ZO.removeLayer(s.bo), s._o && this.ZO.removeLayer(s._o), s.no && s.mo ? this.lo(s.no, s.mo) : s.no ? s.mo || (s.no._o = null) : s.mo.bo = null, this.Bo())
        },
        No: function(t, i) {
            this.ZO.bE(function(e) {
                e.Vo > t && (e.Vo += i)
            })
        },
        lo: function(t, i) {
            var e, s, n, o = this.Mo(t, i),
                h = this._createMidMarker(o, null, "tdt-div-icon-transparent-border");
            t._o = i.bo = h,
                s = function() {
                    var e = i.Vo;
                    h.Vo = e,
                        o.lat = h.PE().lat,
                        o.lng = h.PE().lng,
                        this.CO.MO(e, 0, o),
                        this.LO.splice(e, 0, h),
                        this.No(e, 1),
                        i.Vo++,
                        this.Zo(t, h),
                        this.Zo(h, i),
                        this.CO.wQ("editstart")
                },
                n = function() {
                    h.off("dragstart", s, this),
                        h.off("dragend", n, this),
                        this.lo(t, h),
                        this.lo(h, i)
                },
                e = function() {
                    s.call(this),
                        n.call(this),
                        this.Bo()
                },
                h.on("dragstart", s, this).on("dragend", n, this),
                this.ZO.addLayer(h)
        },
        Zo: function(t, i) {
            t && (t.mo = i),
            i && (i.no = t)
        },
        Mo: function(t, i) {
            var e = this.CO.jE,
                s = e.nq(t.PE()),
                n = e.nq(i.PE());
            return e._q(s.aQ(n).FQ(2))
        }
    });
var initHook = function() {
    this.jt || (T.jo.Poly && (this.jt = new T.jo.Poly(this), this.options.editable && this.jt.enable()), this.on("AQ",
        function() {
            this.jt && this.jt.aE() && this.jt.oU()
        }), this.on("remove",
        function() {
            this.jt && this.jt.aE() && this.jt.Ar()
        }))
};
T.Polyline._(initHook),
    T.Polygon._(initHook),
    T.Polyline.M({
        MO: function(t, i, e) {
            var s, n = this.ht;
            return s = e ? n.splice(t, i, e) : n.splice(t, i),
                this.redraw(),
                s
        }
    }),
    T.Polygon.M({
        MO: function(t, i, e) {
            var s, n = this.ht[0];
            return s = e ? n.splice(t, i, e) : n.splice(t, i),
                this.redraw(),
                s
        }
    }),
    T.jo.fo = T.Tool.extend({
        options: {
            qP: new T.DivIcon({
                iconSize: [11, 11],
                className: "tdt-div-icon-black tdt-editing-icon tdt-edit-move"
            }),
            WP: new T.DivIcon({
                iconSize: [11, 11],
                className: "tdt-div-icon-black tdt-editing-icon tdt-edit-resize"
            })
        },
        initialize: function(t, i) {
            this.go = t,
                T.S.setOptions(this, i)
        },
        oU: function() {
            this.go.jE && (this.jE = this.go.jE, this.ZO || this.ko(), this.jE.addLayer(this.ZO))
        },
        Ar: function() {
            if (this.go.jE) {
                this.wP(this.EP);
                for (var t = 0,
                         i = this.eP.length; t < i; t++) this.wP(this.eP[t]);
                this.eP = null,
                    this.jE.removeLayer(this.ZO),
                    delete this.ZO
            }
            this.jE = null
        },
        Lo: function() {
            this.ZO.clearLayers(),
                this.ko()
        },
        ko: function() {
            this.ZO || (this.ZO = new T.LayerGroup),
                this.RP(),
                this.rP()
        },
        RP: function() {},
        rP: function() {},
        mO: function(t, i) {
            var e = new T.Marker(t, {
                draggable: !0,
                icon: i,
                zIndexOffset: 1e3
            });
            return this.TP(e),
                this.ZO.addLayer(e),
                e
        },
        TP: function(t) {
            t.on("dragstart", this.tP, this).on("drag", this.co, this).on("dragend", this.YP, this)
        },
        wP: function(t) {
            t.off("dragstart", this.tP, this).off("drag", this.co, this).off("dragend", this.YP, this)
        },
        tP: function(t) {
            var i = t.target;
            i.setOpacity(0),
                this.go.wQ("editstart")
        },
        Bo: function() {
            this.go.edited = !0,
                this.go.wQ("edit")
        },
        co: function(t) {
            var i = t.target,
                e = i.PE();
            i === this.EP ? this.QE(e) : this.UP(e),
                this.go.redraw()
        },
        YP: function(t) {
            var i = t.target;
            i.setOpacity(1),
                this.Bo()
        },
        QE: function() {},
        UP: function() {}
    }),
    T.jo.Rectangle = T.jo.fo.extend({
        RP: function() {
            var t = this.go.getBounds(),
                i = t.getCenter();
            this.EP = this.mO(i, this.options.qP)
        },
        rP: function() {
            var t = this.uP();
            this.eP = [];
            for (var i = 0,
                     e = t.length; i < e; i++) this.eP.push(this.mO(t[i], this.options.WP)),
                this.eP[i].IP = i
        },
        tP: function(t) {
            T.jo.fo.prototype.tP.call(this, t);
            var i = this.uP(),
                e = t.target,
                s = e.IP;
            this.iP = i[(s + 2) % 4],
                this.OP(0, s)
        },
        YP: function(t) {
            var i, e, s = t.target;
            s === this.EP && (i = this.go.getBounds(), e = i.getCenter(), s.sr(e)),
                this.OP(1),
                this.oP(),
                T.jo.fo.prototype.YP.call(this, t)
        },
        QE: function(t) {
            for (var i, e = this.go.Ht(), s = this.go.getBounds(), n = s.getCenter(), o = [], h = 0, r = e.length; h < r; h++) {
                o.push([]);
                for (var a = 0,
                         l = e[h].length; a < l; a++) i = [e[h][a].lat - n.lat, e[h][a].lng - n.lng],
                    o[h].push([t.lat + i[0], t.lng + i[1]])
            }
            this.go.Jt(o),
                this.oP()
        },
        UP: function(t) {
            var i;
            this.go.setBounds(T.jq(t, this.iP)),
                i = this.go.getBounds(),
                this.EP.sr(i.getCenter())
        },
        uP: function() {
            var t = this.go.getBounds(),
                i = t.Zq(),
                e = t.getNorthEast(),
                s = t.cq(),
                n = t.getSouthWest();
            return [i, e, s, n]
        },
        OP: function(t) {
            for (var i = 0,
                     e = this.eP.length; i < e; i++) this.eP[i].setOpacity(t)
        },
        oP: function() {
            for (var t = this.uP(), i = 0, e = this.eP.length; i < e; i++) this.eP[i].sr(t[i])
        }
    }),
    T.Rectangle._(function() {
        T.jo.Rectangle && (this.jt = new T.jo.Rectangle(this), this.options.editable && this.jt.enable())
    }),
    T.jo.Circle = T.jo.fo.extend({
        RP: function() {
            var t = this.go.PE();
            this.EP = this.mO(t, this.options.qP)
        },
        rP: function() {
            var t = this.go.PE(),
                i = this.PP(t);
            this.eP = [],
                this.eP.push(this.mO(i, this.options.WP))
        },
        PP: function(t) {
            var i = this.jE.nq(t);
            return this.jE._q([i.x + this.go.EY, i.y])
        },
        QE: function(t) {
            var i = this.PP(t);
            this.eP[0].sr(i),
                this.go.sr(t)
        },
        UP: function(t) {
            var i = this.EP.PE(),
                e = i.distanceTo(t);
            this.go.setRadius(e)
        }
    }),
    T.Circle._(function() {
        T.jo.Circle && (this.jt = new T.jo.Circle(this), this.options.editable && this.jt.enable()),
            this.on("AQ",
                function() {
                    this.jt && this.jt.aE() && this.jt.oU()
                }),
            this.on("remove",
                function() {
                    this.jt && this.jt.aE() && this.jt.Ar()
                })
    }),
    T.pP = {
        AP: function(t) {
            for (var i = [], e = 0, s = t.length; e < s; e++) i.push(this.aP(t[e]));
            return i
        },
        aP: function(t) {
            return t.pQ()
        }
    },
    T.Po = T.extend(T.Po || {},
        {
            Fo: function(t) {
                var i, e, s = t.length,
                    n = 0,
                    o = Math.PI / 180;
                if (s > 2) {
                    for (var h = 0; h < s; h++) i = t[h],
                        e = t[(h + 1) % s],
                        n += (e.lng - i.lng) * o * (2 + Math.sin(i.lat * o) + Math.sin(e.lat * o));
                    n = 6378137 * n * 6378137 / 2
                }
                return Math.abs(n)
            },
            Do: function(t, i) {
                var e;
                return i ? e = t >= 1e4 ? (1e-4 * t).toFixed(2) + " ha": t.toFixed(2) + " m&sup2;": (t *= .836127, e = t >= 3097600 ? (t / 3097600).toFixed(2) + " mi&sup2;": t >= 4840 ? (t / 4840).toFixed(2) + " acres": Math.ceil(t) + " yd&sup2;"),
                    e
            },
            oo: function(t, i) {
                var e;
                return i ? e = t > 1e3 ? (t / 1e3).toFixed(2) + " km": Math.ceil(t) + " m": (t *= 1.09361, e = t > 1760 ? (t / 1760).toFixed(2) + " miles": Math.ceil(t) + " yd"),
                    e
            }
        }),
    T.S.extend(T.ut, {
        SP: function(t, i, e, s) {
            return this.sP(t, e, s) !== this.sP(i, e, s) && this.sP(t, i, e) !== this.sP(t, i, s)
        },
        sP: function(t, i, e) {
            return (e.y - t.y) * (i.x - t.x) > (i.y - t.y) * (e.x - t.x)
        }
    }),
    T.Polyline.M({
        intersects: function() {
            var t, i, e, s = this.lt[0],
                n = s ? s.length: 0;
            if (this.DP()) return ! 1;
            for (t = n - 1; t >= 3; t--) if (i = s[t - 1], e = s[t], this.dP(i, e, t - 2)) return ! 0;
            return ! 1
        },
        qo: function(t, i) {
            return !! this.jE && this.FP(this.jE.kw(t), i)
        },
        FP: function(t, i) {
            var e = this.lt[0],
                s = e ? e.length: 0,
                n = e ? e[s - 1] : null,
                o = s - 2;
            return ! this.DP(1) && this.dP(n, t, o, i ? 1 : 0)
        },
        DP: function(t) {
            var i = this.lt[0],
                e = i ? i.length: 0;
            return e += t || 0,
            !this.lt[0] || e <= 3
        },
        dP: function(t, i, e, s) {
            var n, o, h = this.lt[0];
            s = s || 0;
            for (var r = e; r > s; r--) if (n = h[r - 1], o = h[r], T.ut.SP(t, i, n, o)) return ! 0;
            return ! 1
        }
    }),
    T.Polygon.M({
        intersects: function() {
            var t, i, e, s, n, o = this.lt[0];
            return ! this.DP() && ( !! (t = T.Polyline.prototype.intersects.call(this)) || (i = o.length, e = o[0], s = o[i - 1], n = i - 2, this.dP(s, e, n, 1)))
        }
    }),
    T.MarkTool = T.aO.Marker.extend({
        options: {
            follow: !1
        },
        initialize: function(t, i) {
            this.follow = i && i.follow ? i.follow: this.options.follow,
                this.options.GO = !1,
                T.aO.Marker.prototype.initialize.call(this, t, i),
            this.fP || (this.fP = new T.fT),
                t.addLayer(this.fP);
            var e = this.fP;
            t.on("layerremove",
                function(t) {
                    e && e.hasLayer(t.layer) && e.removeLayer(t.layer)
                })
        },
        PY: function(t) {
            T.aO.Marker.prototype.PY.call(this, t)
        },
        dO: function(t) {
            this.VO ? this.GP = new T.Marker(this.VO.PE(), {
                icon: this.options.icon
            }) : this.GP = new T.Marker(t.lnglat, {
                icon: this.options.icon
            }),
                T.aO.Feature.prototype.dO.call(this, this.GP),
                this.fP.addLayer(this.GP),
                this.wQ("mouseup", {
                    currentLnglat: this.GP.PE(),
                    currentMarker: this.GP,
                    allMarkers: this.getMarkers()
                })
        },
        setPointImage: function(t) {
            var i = T.ur({
                iconUrl: t,
                iconSize: [20, 30],
                iconAnchor: [8, 29]
            });
            this.options.icon = i
        },
        clear: function() {
            this.fP.bE(function(t) {
                t.Qq()
            })
        },
        getMarkers: function() {
            return this.fP.getLayers()
        },
        getMarkControlPoint: function() {
            return null == this.GP ? null: this.GP.PE()
        },
        gP: function() {
            this.fP.bE(function(t) {
                t instanceof T.Marker && t.AE.enable()
            })
        },
        HP: function() {
            this.fP.bE(function(t) {
                t instanceof T.Marker && t.AE.disable()
            })
        },
        enable: function() {
            this.eU || (T.aO.Marker.prototype.enable.call(this), this.GP = null)
        },
        open: function() {
            this.enable()
        },
        close: function() {
            this.disable()
        }
    }),
    T.RectangleTool = T.aO.Rectangle.extend({
        initialize: function(t, i) {
            i && (i.color && (this.options.sO.color = i.color), i.weight && (this.options.sO.weight = i.weight), i.opacity && (this.options.sO.opacity = i.opacity), i.fillColor && (this.options.sO.fillColor = i.fillColor), i.fillOpacity && (this.options.sO.fillOpacity = i.fillOpacity), i.lineStyle && (this.options.sO.lineStyle = i.lineStyle)),
                T.aO.Rectangle.prototype.initialize.call(this, t, i),
            this.fP || (this.fP = new T.fT),
                t.addLayer(this.fP);
            var e = this.fP;
            t.on("layerremove",
                function(t) {
                    e && e.hasLayer(t.layer) && e.removeLayer(t.layer)
                })
        },
        oU: function() {
            T.aO.Rectangle.prototype.oU.call(this)
        },
        dO: function() {
            var t = new T.Rectangle(this.go.getBounds(), this.options.sO);
            T.aO.fo.prototype.dO.call(this, t),
                this.fP.addLayer(t),
                this.wQ("draw", {
                    currentBounds: t.getBounds(),
                    currentRectangle: t,
                    allRectangles: this.getRectangles()
                }),
                t.redraw()
        },
        clear: function() {
            this.fP.bE(function(t) {
                t.Qq()
            })
        },
        getRectangles: function() {
            return this.fP.getLayers()
        },
        open: function() {
            this.enable()
        },
        close: function() {
            this.disable()
        }
    }),
    T.CircleTool = T.aO.Circle.extend({
        initialize: function(t, i) {
            i && (i.color && (this.options.sO.color = i.color), i.fillColor && (this.options.sO.fillColor = i.fillColor), i.weight && (this.options.sO.weight = i.weight), i.opacity && (this.options.sO.opacity = i.opacity), i.fillOpacity && (this.options.sO.fillOpacity = i.fillOpacity), i.lineStyle && (this.options.sO.lineStyle = i.lineStyle)),
                T.aO.Circle.prototype.initialize.call(this, t, i),
            this.fP || (this.fP = new T.fT),
                t.addLayer(this.fP);
            var e = this.fP;
            t.on("layerremove",
                function(t) {
                    e && e.hasLayer(t.layer) && e.removeLayer(t.layer)
                })
        },
        dO: function() {
            var t = new T.Circle(this.lu, this.go.getRadius(), this.options.sO);
            T.aO.fo.prototype.dO.call(this, t),
                this.fP.addLayer(t);
            var i = this.go.getRadius();
            this.wQ("drawend", {
                currentCenter: this.lu,
                currentRadius: i,
                currentCircle: t,
                allCircles: this.getCircles()
            }),
                t.redraw()
        },
        PY: function(t) {
            if (T.aO.Circle.prototype.PY.call(this, t), this.go) {
                var i = this.go.getRadius(),
                    e = new T.Circle(this.lu, this.go.getRadius(), this.options.sO);
                this.wQ("draw", {
                    currentCenter: this.lu,
                    currentRadius: i,
                    currentCircle: e,
                    allCircles: this.getCircles()
                })
            }
        },
        getCircles: function() {
            return this.fP.getLayers()
        },
        clear: function() {
            this.fP.bE(function(t) {
                t.Qq()
            })
        },
        open: function() {
            this.enable()
        },
        close: function() {
            this.disable()
        }
    }),
    T.PolylineTool = T.aO.Polyline.extend({
        initialize: function(t, i) {
            i && (i.color && (this.options.sO.color = i.color), i.weight && (this.options.sO.weight = i.weight), i.opacity && (this.options.sO.opacity = i.opacity), i.lineStyle && (this.options.sO.lineStyle = i.lineStyle), i.showLabel ? (this.to = i.showLabel, this.options.GO = !1) : this.options.GO = !0),
                T.aO.Polyline.prototype.initialize.call(this, t, i),
                this.options.fO = !0,
                this.options.icon = T.Lr({
                    className: "tdt-img3"
                })
        },
        oU: function() {
            T.aO.Polyline.prototype.oU.call(this)
        },
        BO: function() {
            this.ZO.getLayers().length < 2 && this.disable(),
                this.isdb = !1,
                this.KO = !1,
                this.Qo()
        },
        Ar: function() {
            var t = this.jE;
            this.KO && (this._mouselabel && this._mouselabel.Qq(), this.ZO.bE(function(i) {
                i.label && i.label.onRemove(t),
                    i.Qq()
            })),
                t.off("mouseup", this.cO, this),
            this.to || this.ZO.bE(function(t) {
                t.Qq()
            }),
                T.aO.Polyline.prototype.Ar.call(this);
            t.off("dblclick ", this.BO, this)
        },
        cO: function(t) {
            function i(t) {
                return function() {
                    0 == e.isdb && e.mu(t)
                }
            }
            this.isdb = !1;
            var e = this;
            t.To = T.SQ(t.originalEvent.clientX, t.originalEvent.clientY),
                window.setTimeout(i(t), 50)
        },
        dO: function() {
            this._mouselabel && this._mouselabel.Qq();
            var t = new this.Poly(this.CO.Ht(), this.options.sO);
            t.to = this.to;
            var i = this.ZO.getLayers().length,
                e = t.ZO = this.ZO,
                s = this;
            if (T.aO.Feature.prototype.dO.call(this, t), this.lO.addLayer(t), e.getLayers().length > 0 && (e.bE(function(i) {
                i.label && i.label.hP("tdt-img1", i,
                    function() {
                        if (index = 0, 2 == e.getLayers().length) return void t.Qq();
                        for (; index < e.getLayers().length && e.getLayers()[index] !== i; index++);
                        t.MO(index, 1),
                            i.label.onRemove(s.jE),
                            e.removeLayer(i),
                            s.JP(t)
                    })
            }), i > 1)) {
                var n = e.getLayers()[i - 1];
                n.label && (n.label.setBorderLine(.5), n.label.setBorderColor("#CE0000"), n.label.Ow.childNodes[0].innerText = " 总长：" + (this.getDistance(t.Ht()) / 1e3).toFixed(3) + " 公里 ", n.label.hP("tdt-img2", t,
                    function() {
                        t.Qq()
                    }))
            }
            this.wQ("draw", {
                currentLnglats: t.getLngLats(),
                currentDistance: this.getDistance(t.Ht()),
                currentPolyline: t,
                allPolylines: this.getPolylines()
            }),
                t.redraw()
        },
        JP: function(t) {
            var i = t.ZO.getLayers();
            for (index = 0; index < i.length; index++) if (i[index].label) {
                var e = i[index].label;
                if ("SPAN" == e.Ow.childNodes[0].tagName) if (0 == index) e.Ow.childNodes[0].innerText = "起点";
                else {
                    var s = t.Ht().slice(0, index + 1);
                    e.Ow.childNodes[0].innerText = (this.getDistance(s) / 1e3).toFixed(3) + " 公里",
                    index == i.length - 1 && (e.setBorderLine(.5), e.setBorderColor("#CE0000"), e.Ow.childNodes[0].innerText = "总长： " + e.Ow.childNodes[0].innerText, e.Ow.childNodes.length < 3 && e.hP("tdt-img2", t,
                        function() {
                            t.Qq()
                        }))
                }
            }
        },
        mO: function(t) {
            var i = T.aO.Polyline.prototype.mO.call(this, t);
            if (1 == this.ZO.getLayers().length && (T.oQ.ie || !T.oQ.mobile ? this._mouselabel = new T.Label({
                text: this.text ? this.text: "双击结束",
                position: i.getLngLat(),
                Jo: [10, 10],
                className: "tdt-label1",
                zIndex: 5e3
            }).addTo(this.jE) : (this._mouselabel = new T.Control.PadTipControl({}).addTo(this.jE), this._mouselabel.setContext("长按结束" + (this.options.showLabel ? "测距": "画线")), this._mouselabel.setCenter())), this.ZO.getLayers().length > 0 && this.to) {
                var e = "";
                if (1 == this.ZO.getLayers().length) e = "<span>起点<span>";
                else {
                    var s = this.CO.Ht().slice(0);
                    s.push(i.PE()),
                        e = "<span style='display: inline-block;text-align:center;margin:0 auto;'>" + (this.getDistance(s) / 1e3).toFixed(3) + " 公里<span>"
                }
                if (e) {
                    var n = new T.Label({
                        text: e,
                        position: i.getLngLat(),
                        Jo: [10, -15],
                        className: "tdt-label1 ",
                        zIndex: T.aO.Polyline.FO++
                    }).addTo(this.jE);
                    i.label = n
                }
            }
            return i
        },
        _O: function(t) {
            T.aO.Polyline.prototype._O.call(this, t),
                this.wQ("addpoint", {
                    currentLnglats: this.CO.getLngLats(),
                    currentDistance: this.getDistance(this.CO.Ht()),
                    currentPolyline: this.CO,
                    allPolylines: this.getPolylines()
                })
        },
        setTips: function(t) {
            this.text = t
        },
        getDistance: function(t) {
            var e = 0;
            for (i = 0; i < t.length - 1; i++) e += t[i].distanceTo(t[i + 1]);
            return e + ""
        },
        endDraw: function() {
            this.isdb = !1,
                this.KO = !1,
                this.Qo()
        },
        clear: function() {
            this.lO.bE(function(t) {
                t.Qq()
            })
        },
        getPolylines: function() {
            return this.lO.getLayers()
        },
        open: function() {
            this.enable()
        },
        close: function() {
            this.disable()
        }
    }),
    T.PolygonTool = T.aO.Polygon.extend({
        initialize: function(t, i) {
            i && (i.color && (this.options.sO.color = i.color), i.weight && (this.options.sO.weight = i.weight), i.opacity && (this.options.sO.opacity = i.opacity), i.fillColor && (this.options.sO.fillColor = i.fillColor), i.fillOpacity && (this.options.sO.fillOpacity = i.fillOpacity), i.lineStyle && (this.options.sO.lineStyle = i.lineStyle), i.showLabel && (this.to = i.showLabel)),
                T.aO.Polygon.prototype.initialize.call(this, t, i)
        },
        oU: function() {
            T.aO.Polygon.prototype.oU.call(this),
            this.jP || (this.jP = new T.fT),
                this.jE.addLayer(this.jP);
            var t = this.jP;
            this.jE.on("layerremove",
                function(i) {
                    t && t.hasLayer(i.layer) && i.layer && i.layer.KP && (i.layer.KP.Qq(), t.removeLayer(i.layer))
                }),
                this.bU = this.jE.bU.eU,
                this.jE.bU.disable(),
                this.KO = !0,
                this.KP = null
        },
        Ar: function() {
            var t = this.jE;
            T.aO.Polygon.prototype.Ar.call(this),
            this.KO && (this._mouselabel && this._mouselabel.Qq(), this.KP && this.KP.Qq()),
                this.ZO.bE(function(i) {
                    i.label && i.label.onRemove(t),
                        i.Qq()
                }),
                t.off("mouseup", this.cO, this),
            this.bU && this.jE.bU.enable(),
                t.off("dblclick ", this.BO, this)
        },
        BO: function() {
            this.ZO.getLayers().length < 2 && this.disable(),
                this.isdb = !1,
                this.KO = !1,
                this.Qo()
        },
        cO: function(t) {
            function i(t) {
                return function() {
                    0 == e.isdb && e.mu(t)
                }
            }
            this.isdb = !1;
            var e = this;
            t.To = T.SQ(t.originalEvent.clientX, t.originalEvent.clientY),
                window.setTimeout(i(t), 50)
        },
        mO: function(t) {
            var i = new T.Marker(t, {
                icon: this.options.icon,
                zIndexOffset: T.aO.Polyline.FO++
            });
            if (i.setOpacity(0), this.ZO.addLayer(i), 1 == this.ZO.getLayers().length && (T.oQ.ie || !T.oQ.mobile ? this._mouselabel = new T.Label({
                text: this.text ? this.text: "双击结束",
                position: i.getLngLat(),
                Jo: [10, 10],
                className: "tdt-label1 ",
                zIndex: 4999
            }).addTo(this.jE) : (this._mouselabel = new T.Control.PadTipControl({}).addTo(this.jE), this._mouselabel.setContext("长按结束" + (this.options.showLabel ? "测面": "画面")), this._mouselabel.setCenter())), this.to) {
                var e = this.ZO.getLayers().length,
                    s = this.CO.Ht()[0].slice(0);
                s.push(i.getLngLat());
                var n = this.getArea(s),
                    o = (n / 1e6).toFixed(3);
                0 == o ? o = n.toFixed(3) + "平方米": o += "平方千米",
                3 == e && (this.KP = new T.Label({
                    text: "<span style='display: inline-block;text-align:center;margin:0 auto;'>" + o + " </span>",
                    position: i.getLngLat(),
                    Jo: [10, -15],
                    className: "tdt-label1 ",
                    zIndex: T.aO.Polyline.FO++
                }).addTo(this.jE)),
                e > 3 && (this.KP.Ow.childNodes[0].innerText = o, this.KP.sr(i.getLngLat()))
            }
            return i
        },
        dO: function() {
            var t = new this.Poly(this.CO.Ht(), this.options.sO);
            if (t.to = this.to, T.aO.Feature.prototype.dO.call(this, t), this.jP.addLayer(t), this.wQ("draw", {
                currentLnglats: t.getLngLats()[0],
                currentArea: this.getArea(t.Ht()[0]),
                currentPolygon: t,
                allPolygons: this.getPolygons()
            }), this._mouselabel && this._mouselabel.Qq(), this.to && this.KP) {
                this.KP.setBorderLine(.5),
                    this.KP.setBorderColor("#CE0000"),
                    this.KP.Ow.childNodes[0].innerText = "总面积：" + this.KP.Ow.childNodes[0].innerText;
                t.KP = this.KP,
                    this.KP.hP("tdt-img2", t,
                        function() {
                            t.Qq()
                        })
            }
            t.redraw()
        },
        _O: function(t) {
            T.aO.Polygon.prototype._O.call(this, t),
                this.wQ("addpoint", {
                    currentPolygon: this.CO,
                    currentLnglats: this.CO.getLngLats()[0],
                    currentArea: this.getArea(this.CO.Ht()),
                    allPolygons: this.getPolygons()
                })
        },
        setTips: function(t) {
            this.text = t
        },
        getPolygons: function() {
            return this.jP.getLayers()
        },
        getArea: function(t) {
            return T.Po.Fo(t)
        },
        endDraw: function() {
            this.isdb = !1,
                this.KO = !1,
                this.Qo()
        },
        clear: function() {
            this.jP.bE(function(t) {
                t.Qq()
            })
        },
        open: function() {
            this.enable()
        },
        close: function() {
            this.disable()
        }
    }),
    T.Control.PadTipControl = T.Control.extend({
        initialize: function(t) {
            this.setOptions(t)
        },
        onAdd: function(t) {
            this.map = t;
            var i = this.div = T._Q.s("a", "tdt-noDataTips"),
                e = this.left = T._Q.s("a", "tdt-tabtop_left", i);
            e.style.color = "#FFFFFF";
            var s = T._Q.s("a", "tdt-tabtop_rt", i);
            return self = this,
                s.onclick = function() {
                    t.removeControl(self)
                },
                i
        },
        setCenter: function() {
            this.div.style.marginRight = (this.map.Ow.offsetWidth - this.div.offsetWidth) / 2 + "px"
        },
        setContext: function(t) {
            this.left.innerHTML = t
        },
        onRemove: function(t) {
            var i = this.div.parentNode;
            i && (i.removeChild(this.div), this.map = null, this.div = null)
        }
    }),
    T.labelVersion = "0.2.2-dev",
    T.Label = T.Overlay.extend({
        includes: T.iQ.OQ,
        options: {
            type: 1,
            className: "",
            JO: !1,
            kP: "right",
            LP: !1,
            Jo: [12, -15],
            offset: new T.Point(0, 0),
            opacity: 1,
            Nr: !1
        },
        initialize: function(t, i) {
            if (T.setOptions(this, t), this.br = i, this.lP = T.oQ.any3d && this.options.Nr, this.ZP = !1, t && (t.text && this.setContent(t.text), t.position && this.setLngLat(t.position), this.options.zIndex && (this.Jr = this.options.zIndex), t.offset && t.offset instanceof T.Point)) {
                this.options.offset = t.offset;
                var e = this.options.offset;
                this.options.Jo = [e.x + 12, e.y - 15]
            }
            this.options.JO = !0,
                this.options.LP = !0
        },
        onAdd: function(t) {
            this.jE = t,
                this.fu = this.options.hE ? t.aw[this.options.hE] : this.br instanceof T.Marker ? t.aw.markerPane: t.aw.popupPane,
            this.Ow || this.DW(),
                this.fu.appendChild(this.Ow),
                this.hr(),
                this.Oe(),
                this.setOpacity(this.options.opacity),
                t.on("moveend", this.TE, this).on("viewreset", this.CP, this),
            this.lP && t.on("Ge", this.VP, this),
            T.oQ.touch && !this.options.LP && (T.oq.on(this.Ow, "click", this.close, this), t.on("click", this.close, this))
        },
        onRemove: function(t) {
            this.fu.removeChild(this.Ow),
                t.off({
                        Ge: this.VP,
                        moveend: this.TE,
                        viewreset: this.CP
                    },
                    this),
                this.cP(),
                this.wQ("remove", {}),
                this.jE = null
        },
        sr: function(t) {
            return this.or = T.fq(t),
            this.jE && this.WT(),
                this
        },
        setContent: function(t) {
            return this.BP = this.ET,
                this.ET = t,
                this.eT(),
                this
        },
        getElement: function() {
            return this.Ow
        },
        close: function() {
            var t = this.jE;
            t && (T.oQ.touch && !this.options.LP && (T.oq.off(this.Ow, "click", this.close), t.off("click", this.close, this)), t.removeLayer(this))
        },
        vP: function(t) {
            this.Jr = t,
            this.Ow && this.Jr && (this.Ow.style.zIndex = t)
        },
        setOpacity: function(t) {
            this.options.opacity = t,
            this.Ow && T._Q.setOpacity(this.Ow, t)
        },
        DW: function() {
            this.options.className ? this.Ow = T._Q.s("div", this.options.className + " tdt-zoom-animated") : this.Ow = T._Q.s("div", "tdt-label  tdt-zoom-animated"),
                this.vP(this.Jr)
        },
        Oe: function() {
            this.jE && (this.Ow.style.visibility = "hidden", this.eT(), this.WT(), this.Ow.style.visibility = "")
        },
        eT: function() {
            this.ET && this.jE && this.NP !== this.ET && "string" == typeof this.ET && (this.Ow.innerHTML = this.ET, this.NP = this.ET, this._labelWidth = this.Ow.offsetWidth)
        },
        WT: function() {
            var t = this.jE.kw(this.or);
            this.bP(t)
        },
        bP: function(t) {
            var i = this.jE,
                e = this.Ow,
                s = i.BW(i.getCenter()),
                n = i.Zw(t),
                o = this.options.kP,
                h = this._labelWidth,
                r = T.SQ(this.options.Jo);
            "right" === o || "auto" === o && n.x < s.x ? (T._Q.Rq(e, "tdt-label-right"), T._Q.Tq(e, "tdt-label-left"), t = t.AQ(r)) : (T._Q.Rq(e, "tdt-label-left"), T._Q.Tq(e, "tdt-label-right"), t = t.AQ(T.SQ( - r.x - h, r.y))),
                T._Q.setPosition(e, t)
        },
        VP: function(t) {
            var i = this.jE.DE(this.or, t.zoom, t.center).hQ();
            this.bP(i)
        },
        TE: function() {
            this.lP && "auto" !== this.options.kP || this.WT()
        },
        CP: function(t) {
            t && t.hard && this.Oe()
        },
        hr: function() {
            var t = this.Ow,
                i = ["dblclick", "mousedown", "mouseover", "mouseout", "contextmenu"];
            T._Q.Rq(t, "tdt-clickable"),
                T.oq.on(t, "click", this.MP, this);
            for (var e = 0; e < i.length; e++) T.oq.on(t, i[e], this.nP, this)
        },
        cP: function() {
            var t = this.Ow,
                i = ["dblclick", "mousedown", "mouseover", "mouseout", "contextmenu"];
            T._Q.Tq(t, "tdt-clickable"),
                T.oq.off(t, "click", this.MP, this);
            for (var e = 0; e < i.length; e++) T.oq.off(t, i[e], this.nP, this)
        },
        MP: function(t) {
            this.IQ(t.type) && T.oq.stopPropagation(t);
            var i = this.jE.BW(this.or);
            this.wQ(t.type, {
                lnglat: this.or,
                containerPoint: i
            })
        },
        nP: function(t) {
            var i = this.jE.BW(this.or);
            this.wQ(t.type, {
                lnglat: this.or,
                containerPoint: i
            }),
            "contextmenu" === t.type && this.IQ(t.type) && T.oq.preventDefault(t),
                "mousedown" !== t.type ? T.oq.stopPropagation(t) : T.oq.preventDefault(t)
        },
        getType: function() {
            return 1
        },
        getLngLat: function() {
            return this.or
        },
        setLngLat: function(t) {
            return this.or = T.fq(t),
            this.jE && this.WT(),
                this
        },
        setOffset: function(t) {
            return t && t instanceof T.Point && (this.options.offset = t, this.options.Jo = [t.x + 12, t.y - 15]),
            this.jE && this.WT(),
                this
        },
        getOffset: function() {
            return this.offset_Point
        },
        setLabel: function(t) {
            this.setContent(t)
        },
        getLabel: function() {
            this.getContent()
        },
        setTitle: function(t) {
            return this._P = t,
            this.Ow || this.DW(),
                this.Ow.title = this._P,
                this
        },
        getTitle: function() {
            return this._P
        },
        setZindex: function(t) {
            this.vP(t)
        },
        getFontSize: function(t) {
            return this.Ow.style.fontSize
        },
        setFontSize: function(t) {
            return this._FontSize = t,
            this.Ow || this.DW(),
                this.Ow.style.fontSize = this._FontSize + "pt",
                this
        },
        setFontColor: function(t) {
            return this.mP = t,
            this.Ow || this.DW(),
                this.Ow.style.color = this.mP,
                this
        },
        getFontColor: function() {
            return this.Ow.style.color
        },
        setBackgroundColor: function(t) {
            return t || (t = "transparent"),
                this.Qp = t,
            this.Ow || this.DW(),
                this.Ow.style.backgroundColor = this.Qp,
                this
        },
        getBackgroundColor: function() {
            return this.Ow.style.backgroundColor
        },
        setBorderLine: function(t) {
            return this.qp = t,
            this.Ow || this.DW(),
                this.Ow.style.borderWidth = this.qp + "pt",
                this.Ow.style.boxShadow = "0px 0px 0px 0px",
                this
        },
        getBorderLine: function() {
            return this.Ow.style.borderWidth
        },
        setBoxShadow: function(t) {
            return this.Ow.style.boxShadow = t,
                this
        },
        getBoxShadow: function() {
            return this.Ow.style.boxShadow
        },
        setBorderColor: function(t) {
            return t || (t = "transparent"),
                this.mP = t,
            this.Ow || this.DW(),
                this.Ow.style.borderColor = this.mP,
                this
        },
        getBorderColor: function() {
            return this.Ow.style.borderColor
        },
        setOpacity: function(t) {
            this.Wp = t,
            this.Ow && T._Q.setOpacity(this.Ow, this.Wp)
        },
        getOpacity: function() {
            return this.Wp
        },
        hP: function(t, i, e) {
            var s = this.Ow,
                n = T._Q.s("a", t, s);
            T.oq.on(n, "click", e)
        }
    }),
    T.wp = {
        showLabel: function() {
            return this.label && this.jE && (this.label.sr(this.or), this.jE.showLabel(this.label)),
                this
        },
        hideLabel: function() {
            return this.label && this.label.close(),
                this
        },
        Ep: function(t) {
            this.ep !== t && (this.ep = t, t ? (this.Rp(), this.showLabel()) : (this.rp(), this.hideLabel()))
        },
        Tp: function(t, i) {
            var e = this.options.icon ? this.options.icon.options.tp: this.options.tp,
                s = T.SQ(e) || T.SQ(0, 0);
            return s = s.AQ(T.Label.prototype.options.Jo),
            i && i.Jo && (s = s.AQ(i.Jo)),
                i = T.S.extend({
                        Jo: s
                    },
                    i),
                this.ep = i.LP,
            this.label || (this.ep || this.rp(), this.on("remove", this.hideLabel, this).on("move", this.Yp, this).on("AQ", this.Up, this), this.up = !0),
                this.label = new T.Label(i, this).setContent(t),
                this
        },
        Ip: function() {
            return this.label && (this.hideLabel(), this.label = null, this.up && (this.ep || this.Rp(), this.off("remove", this.hideLabel, this).off("move", this.Yp, this).off("AQ", this.Up, this)), this.up = !1),
                this
        },
        ip: function(t) {
            this.label && this.label.setContent(t)
        },
        getLabel: function() {
            return this.label
        },
        Up: function() {
            this.ep && this.showLabel()
        },
        rp: function() {
            this.on("mouseover", this.showLabel, this).on("mouseout", this.hideLabel, this),
            T.oQ.touch && this.on("click", this.showLabel, this)
        },
        Rp: function() {
            this.off("mouseover", this.showLabel, this).off("mouseout", this.hideLabel, this),
            T.oQ.touch && this.off("click", this.showLabel, this)
        },
        Yp: function(t) {
            this.label.sr(t.KT)
        }
    },
    T.Icon.Default.n({
        tp: new T.Point(9, -20)
    }),
    T.Marker.n({
        icon: new T.Icon.Default
    }),
    T.Marker.M(T.wp),
    T.Marker.M({
        Op: T.Marker.prototype.se,
        se: function(t) {
            var i = this.Jr + t;
            this.Op(t),
            this.label && this.label.vP(i)
        },
        op: T.Marker.prototype.setOpacity,
        setOpacity: function(t, i) {
            this.options.Pp = i,
                this.op(t)
        },
        pp: T.Marker.prototype.Se,
        Se: function() {
            var t = 0 === this.options.opacity ? 0 : 1;
            this.pp(),
            this.label && this.label.setOpacity(this.options.Pp ? this.options.opacity: t)
        },
        Ap: T.Marker.prototype.sr,
        sr: function(t) {
            return this.label && !this.ep && this.hideLabel(),
                this.Ap(t)
        }
    }),
    T.wY.n({
        tp: new T.Point(0, 0)
    }),
    T.wY.M(T.wp),
    T.jT.M({
        Tp: function(t, i) {
            return this.label && this.label.options === i || (this.label = new T.Label(i, this)),
                this.label.setContent(t),
            this.ap || (this.on("mouseover", this.to, this).on("mousemove", this.Yp, this).on("mouseout remove", this.Sp, this), T.oQ.touch && this.on("click", this.to, this), this.ap = !0),
                this
        },
        Ip: function() {
            return this.label && (this.Sp(), this.label = null, this.ap = !1, this.off("mouseover", this.to, this).off("mousemove", this.Yp, this).off("mouseout remove", this.Sp, this)),
                this
        },
        ip: function(t) {
            this.label && this.label.setContent(t)
        },
        to: function(t) {
            this.label.sr(t.KT),
                this.jE.showLabel(this.label)
        },
        Yp: function(t) {
            this.label.sr(t.KT)
        },
        Sp: function() {
            this.label.close()
        }
    }),
    T.Map.M({
        showLabel: function(t) {
            return this.addLayer(t)
        }
    }),
    T.fT.M({
        clearLayers: function() {
            return this.Ip(),
                this.bE(this.removeLayer, this),
                this
        },
        Tp: function(t, i) {
            return this.kT("Tp", t, i)
        },
        Ip: function() {
            return this.kT("Ip")
        },
        ip: function(t) {
            this.kT("ip", t)
        }
    }),
    T.Control.sp = T.Control.extend({
        options: {
            position: "bottomright",
            Dp: !1,
            dp: -4,
            Fp: !1,
            fp: !1,
            Nr: !1,
            Gp: !1,
            gp: !1,
            width: 140,
            height: 140,
            Hp: 18,
            hp: 18,
            Jp: {
                weight: 2,
                JO: !1,
                opacity: .4,
                fillOpacity: .2,
                color: "#0066cc",
                fillColor: "blue"
            },
            jp: {
                weight: 2,
                JO: !1,
                opacity: 0,
                fillOpacity: 0,
                color: "#0066cc",
                fillColor: "blue"
            },
            Kp: {
                kp: "隐藏",
                Lp: "打开"
            },
            mapOptions: {}
        },
        initialize: function(t) {
            T.S.setOptions(this, t),
                this.options.Jp.JO = !1,
                this.options.jp.JO = !1,
                this.Dp = !0
        },
        onAdd: function(t) {
            this.lp = t,
                this._containerBorder = T._Q.s("div", "tdt-control-minimap-edge"),
                this._minimapContainer = this.Ow = T._Q.s("div", "tdt-control-minimap"),
                this._containerBorder.appendChild(this.Ow),
                T.oq.iT(this._containerBorder),
                T.oq.on(this._containerBorder, "mousewheel", T.oq.stopPropagation);
            var i = null;
            if (this.lp.getMapType()) {
                for (var e = this.lp.getMapType().getLayers(), s = [], n = 0; n < e.length; n++) {
                    var o = new T.TileLayer("", e[n].options);
                    o.getTileUrl = e[n].getTileUrl,
                        s.push(o)
                }
                i = new T.MapType(s, this.lp.getMapType().getName())
            }
            var h = {
                cE: !1,
                AE: !this.options.fp,
                FI: !1,
                _U: !1,
                bU: !1,
                Nr: !1,
                Gp: this.options.Gp,
                Ju: this.options.fp ? "center": !this.Zp(),
                SE: !this.Zp(),
                IW: t.options.IW,
                layers: i
            };
            return h = T.S.extend(this.options.mapOptions, h),
                this.Cp = new T.Map(this.Ow, h),
                this.lp.on("maptypechange", this.mapTypeChange, this),
                this.Vp = !1,
                this.cp = !1,
                this.Bp = !1,
                this.vp = this.options.gp,
            this.options.Dp && this.Np(),
                this.Cp.sE(T.S.D(function() {
                        this.bp = T.WY(this.lp.getBounds(), this.options.Jp).addTo(this.Cp),
                            renderRectoptions = {
                                MW: 30
                            },
                            this.renderRect = new T.SVG(renderRectoptions),
                            this.options.jp.iW = this.renderRect,
                            this.Mp = T.WY(this.lp.getBounds(), this.options.jp).addTo(this.Cp),
                            this.lp.on("moveend", this.np, this),
                            this.lp.on("move", this._p, this),
                            this.Cp.on("movestart", this.mp, this),
                            this.Cp.on("move", this.QA, this),
                            this.Cp.on("moveend", this.qA, this),
                            this.Cp.on("dblclick", this._onMiniMapDblclick, this),
                        T.oQ.ie && (T.oq.on(this.Cp.getContainer(), "mousedown",
                            function() {
                                this.Cp.getContainer().setCapture()
                            },
                            this), T.oq.on(this.Cp.getContainer(), "mouseup",
                            function() {
                                this.Cp.getContainer().releaseCapture()
                            },
                            this))
                    },
                    this)),
                this._containerBorder
        },
        mapTypeChange: function(t) {
            var i = null;
            if (t.mapType) {
                for (var e = t.mapType.getLayers(), s = [], n = 0; n < e.length; n++) {
                    var o = new T.TileLayer("", e[n].options);
                    o.getTileUrl = e[n].getTileUrl,
                        s.push(o)
                }
                i = new T.MapType(s, this.lp.getMapType().getName()),
                    this.Cp.setMapType(i)
            }
        },
        addTo: function(t) {
            T.Control.prototype.addTo.call(this, t);
            var i = this.options.fp || this.lp.getCenter();
            return i && this.Cp.gW(i, this.WA(!0)),
                this.wA(this.EA()),
                this
        },
        onRemove: function(t) {
            this.lp.off("moveend", this.np, this),
                this.lp.off("move", this._p, this),
                this.Cp.off("moveend", this.qA, this)
        },
        Np: function() {
            this.eA = this.options.Dp ? this.AI("", this.options.Kp.kp, "tdt-control-minimap-toggle-display tdt-control-minimap-toggle-display-" + this.options.position, this._minimapContainer, this.RA, this) : void 0,
                this.eA.style.width = this.options.Hp + "px",
                this.eA.style.height = this.options.hp + "px"
        },
        AI: function(t, i, e, s, n, o) {
            var h = T._Q.s("a", e, s);
            h.innerHTML = t,
                h.href = "#",
                h.title = i;
            var r = T.oq.stopPropagation;
            return T.oq.on(h, "click", r).on(h, "mousedown", r).on(h, "dblclick", r).on(h, "click", T.oq.preventDefault).on(h, "click", n, o),
                h
        },
        RA: function() {
            this.Bp = !0,
                this.vp ? (this.TA(), this.eA.title = this.options.Kp.kp) : (this.rA(), this.eA.title = this.options.Kp.Lp)
        },
        wA: function(t) {
            t !== this.vp && (this.vp ? this.TA() : this.rA())
        },
        rA: function() {
            this.options.Dp ? (this._minimapContainer.style.width = this.options.Hp + "px", this._minimapContainer.style.height = this.options.hp + "px", this.eA.className += " minimized-" + this.options.position) : (this.Ow.style.display = "none", this._containerBorder.style.display = "none"),
                this.vp = !0
        },
        TA: function() {
            this.options.Dp ? (this._minimapContainer.style.width = this.options.width + "px", this._minimapContainer.style.height = this.options.height + "px", this.eA.className = this.eA.className.replace("minimized-" + this.options.position, "")) : (this.Ow.style.display = "block", this._containerBorder.style.display = "block"),
                this.vp = !1
        },
        np: function(t) {
            if (this.cp) this.cp = !1;
            else {
                var i = this.options.fp || this.lp.getCenter();
                this.Vp = !0,
                    this.Cp.gW(i, this.WA(!0)),
                    this.wA(this.EA())
            }
            this.bp.setBounds(this.lp.getBounds())
        },
        _p: function(t) {
            this.bp.setBounds(this.lp.getBounds())
        },
        mp: function(t) {
            if (!this.options.fp) {
                var i = this.bp.getBounds(),
                    e = this.Cp.BW(i.getSouthWest()),
                    s = this.Cp.BW(i.getNorthEast()),
                    n = this.Cp.BW(i.getCenter()),
                    o = Math.abs(i.getSouthWest().lng - i.getNorthEast().lng),
                    h = Math.abs(i.getSouthWest().lat - i.getNorthEast().lat);
                this._lastAimingRectPosition = {
                    sw: e,
                    ne: s,
                    ce: n,
                    coWidth: o,
                    coHeight: h
                }
            }
        },
        _onMiniMapDblclick: function(t) {
            this.Cp.panTo(t.lnglat)
        },
        QA: function(t) {
            if (!this.options.fp && !this.Vp && this._lastAimingRectPosition) {
                var i = this.Cp.getCenter().lng + this._lastAimingRectPosition.coWidth / 2,
                    e = this.Cp.getCenter().lng - this._lastAimingRectPosition.coWidth / 2,
                    s = this.Cp.getCenter().lat + this._lastAimingRectPosition.coHeight / 2,
                    n = this.Cp.getCenter().lat - this._lastAimingRectPosition.coHeight / 2;
                this.Mp.setBounds(new T.Kq(new T.dq(n, e), new T.dq(s, i))),
                    this.bp.setStyle({
                        opacity: .2,
                        fillOpacity: .2
                    }),
                    this.Mp.setStyle({
                        opacity: .6,
                        fillOpacity: .3
                    })
            }
        },
        qA: function(t) {
            this.Vp ? this.Vp = !1 : (this.cp = !0, this.lp.gW(this.Cp.getCenter(), this.WA(!1)), this.Mp.setStyle({
                opacity: 0,
                fillOpacity: 0
            }), this.bp.setStyle({
                opacity: .4,
                fillOpacity: .2
            }))
        },
        Zp: function() {
            var t = this.options.Fp;
            return this.tA(t) && this.YA(t)
        },
        WA: function(t) {
            if (this.Zp()) return t ? this.options.Fp: this.lp.getZoom();
            if (t) return this.lp.getZoom() + this.options.dp;
            var i, e = this.Cp.getZoom() - this.lp.getZoom(),
                s = this.Cp.getZoom() - this.options.dp;
            return e > this.options.dp && this.lp.getZoom() < this.Cp.getMinZoom() - this.options.dp ? this.Cp.getZoom() > this._lastMiniMapZoom ? (i = this.lp.getZoom() + 1, this.Cp.setZoom(this.Cp.getZoom() - 1)) : i = this.lp.getZoom() : i = s,
                this._lastMiniMapZoom = this.Cp.getZoom(),
                i
        },
        EA: function() {
            return this.Bp ? this.vp: this.options.Gp ? !!this.lp.getBounds().contains(this.Cp.getBounds()) : this.vp
        },
        YA: function(t) {
            return "number" == typeof t
        },
        tA: function(t) {
            return "undefined" != typeof t
        }
    }),
    T.Map.n({
        UA: !1
    }),
    T.Map._(function() {
        this.options.UA && (this.UA = (new MiniMap).addTo(this))
    }),
    T.Control.OverviewMap = T.Control.sp.extend({
        includes: T.iQ.OQ,
        options: {
            anchor: "TMAP_ANCHOR_BOTTOM_RIGH",
            size: new T.SQ(150, 150),
            isOpen: !1
        },
        initialize: function(t) {
            t && (t.size && (this.options.width = t.size.x, this.options.height = t.size.y), this.ZP = t.isOpen, this.vp = t.isOpen),
                this.options.Dp = !0,
                T.Control.sp.prototype.initialize.call(this, t)
        },
        onAdd: function(t) {
            var i = T.Control.sp.prototype.onAdd.call(this, t);
            this.ZP ? this.TA() : this.rA();
            var e = T.Icon.Default.imagePath;
            return this.setButtonImage(e + "/Open.png", e + "/Close.png"),
                i
        },
        setButtonImage: function(t, i) {
            this.ButtonImageUrl = "url(" + t + ")",
                this.ButtonImageReverseUrl = "url(" + i + ")",
                this.ZP ? T.oQ.ielt9 && (this.eA.style.backgroundImage = this.ButtonImageUrl) : T.oQ.ielt9 && (this.eA.style.backgroundImage = this.ButtonImageReverseUrl),
            T.oQ.ielt9 || (this.eA.style.backgroundImage = this.ButtonImageUrl)
        },
        _setButtonImage: function(t) {
            return this.eA.style.backgroundImage = "url(" + t + ")",
                this
        },
        setBorderColor: function(t) {
            this._minimapContainer.style.borderColor = t
        },
        setBorderWidth: function(t) {
            this._minimapContainer.style.borderWidth = t + "px"
        },
        setRectBorderColor: function(t) {
            this.options.Jp.color = t,
                this.options.Jp.fillColor = t,
                this.bp.setStyle(this.options.Jp)
        },
        setRectBackColor: function(t) {
            this.options.jp.color = t,
                this.options.jp.fillColor = t,
                this.Mp.setStyle(this.options.jp)
        },
        RA: function() {
            T.Control.sp.prototype.RA.call(this),
                this.wQ("viewchange", {
                    isOpen: !this.vp
                }),
                this.ZP = !this.vp,
                this.ZP ? this.ButtonImageUrl && (this.eA.style.backgroundImage = this.ButtonImageUrl) : this.ButtonImageReverseUrl && (this.eA.style.backgroundImage = this.ButtonImageReverseUrl)
        },
        changeView: function() {
            this.RA()
        },
        isOpen: function() {
            return ! this.vp
        },
        getMiniMap: function() {
            return this.Cp
        }
    }),
    T.uA = T.fT.extend({
        options: {
            IA: 80,
            iA: null,
            OA: !1,
            oA: !0,
            PA: !0,
            pA: !1,
            AA: null,
            aA: !0,
            Tw: !1,
            SA: !1,
            sA: 1,
            DA: {
                weight: 1.5,
                color: "#222",
                opacity: .5
            },
            dA: !1,
            FA: 200,
            fA: 50,
            GA: null,
            gA: {}
        },
        initialize: function(t) {
            T.S.setOptions(this, t),
            this.options.iA || this.setStyles(this.options.styles, !0),
                this.HA = T.lT(),
                this.HA.TQ(this),
                this.hA = T.lT(),
                this.hA.TQ(this),
                this.JA = 0,
                this.jA = [],
                this.KA = [],
                this.kA = null,
                this.LA = [];
            var i = T._Q.Iq && this.options.Tw;
            T.extend(this, i ? this.lA: this.ZA),
                this.CA = i ? T.VA: T.cA
        },
        addLayer: function(t) {
            if (t instanceof T.LayerGroup) return this.addLayers([t]);
            if (!t.PE) return this.hA.addLayer(t),
                this;
            if (!this.jE) return this.jA.push(t),
                this;
            if (this.hasLayer(t)) return this;
            this.BA && this.BA(),
                this.Wi(t, this.vA),
                this.bA.NA();
            var i = t,
                e = this.jE.getZoom();
            if (t.MA) for (; i.MA.fW >= e;) i = i.MA;
            return this.kA.contains(i.PE()) && (this.options.SA ? this.nA(t, i) : this._A(t, i)),
                this._viewChangeEndNotClustering(),
                this
        },
        removeLayer: function(t) {
            return t instanceof T.LayerGroup ? this.removeLayers([t]) : t.PE ? this.jE ? t.MA ? (this.BA && (this.BA(), this.Qa(t)), this.qa(t, !0), this.bA.NA(), t.off("move", this.Wa, this), this.HA.hasLayer(t) && (this.HA.removeLayer(t), t.wa && t.wa()), this) : this: (!this.mA(this.jA, t) && this.hasLayer(t) && this.KA.push(t), this) : (this.hA.removeLayer(t), this)
        },
        addLayers: function(t) {
            if (!T.S.l(t)) return this.addLayer(t);
            var i, e = this.HA,
                s = this.hA,
                n = this.options.dA,
                o = this.options.FA,
                h = this.options.GA,
                r = t.length,
                a = 0,
                l = !0;
            if (this.jE) {
                var u = (new Date).getTime(),
                    c = T.D(function() {
                            for (var f = (new Date).getTime(); a < r; a++) {
                                if (n && a % 200 === 0) {
                                    var d = (new Date).getTime() - f;
                                    if (d > o) break
                                }
                                if (i = t[a], i instanceof T.LayerGroup) l && (t = t.slice(), l = !1),
                                    this.Ea(i, t),
                                    r = t.length;
                                else if (i.PE) {
                                    if (!this.hasLayer(i) && (this.Wi(i, this.vA), i.MA && 2 === i.MA.ea())) {
                                        var p = i.MA.Ra(),
                                            m = p[0] === i ? p[1] : p[0];
                                        e.removeLayer(m)
                                    }
                                } else s.addLayer(i)
                            }
                            h && h(a, r, (new Date).getTime() - u),
                                a === r ? (this.bA.NA(), this.HA.bE(function(t) {
                                    t instanceof T.VA && t.ra && t.Ta()
                                }), this.bA.ta(null, this.fW, this.kA)) : setTimeout(c, this.options.fA)
                        },
                        this);
                c(),
                    this._viewChangeEndNotClustering()
            } else for (var f = this.jA; a < r; a++) i = t[a],
                i instanceof T.LayerGroup ? (l && (t = t.slice(), l = !1), this.Ea(i, t), r = t.length) : i.PE ? this.hasLayer(i) || f.push(i) : s.addLayer(i);
            return this
        },
        removeLayers: function(t) {
            var i, e, s = t.length,
                n = this.HA,
                o = this.hA,
                h = !0;
            if (!this.jE) {
                for (i = 0; i < s; i++) e = t[i],
                    e instanceof T.LayerGroup ? (h && (t = t.slice(), h = !1), this.Ea(e, t), s = t.length) : (this.mA(this.jA, e), o.removeLayer(e), this.hasLayer(e) && this.KA.push(e));
                return this
            }
            if (this.BA) {
                this.BA();
                var r = t.slice(),
                    a = s;
                for (i = 0; i < a; i++) e = r[i],
                    e instanceof T.LayerGroup ? (this.Ea(e, r), a = r.length) : this.Qa(e)
            }
            for (i = 0; i < s; i++) e = t[i],
                e instanceof T.LayerGroup ? (h && (t = t.slice(), h = !1), this.Ea(e, t), s = t.length) : e.MA ? (this.qa(e, !0, !0), n.hasLayer(e) && (n.removeLayer(e), e.wa && e.wa())) : o.removeLayer(e);
            return this.bA.NA(),
                this.bA.ta(null, this.fW, this.kA),
                n.bE(function(t) {
                    t instanceof T.VA && t.Ta()
                }),
                this
        },
        clearLayers: function() {
            return this.jE || (this.jA = [], delete this.Ya, delete this.Ua),
            this.ua && this.ua(),
                this.HA.clearLayers(),
                this.hA.clearLayers(),
                this.bE(function(t) {
                    t.off("move", this.Wa, this),
                        delete t.MA
                }),
            this.jE && this.Ia(),
                this
        },
        getBounds: function() {
            var t = new T.Kq;
            this.bA && t.extend(this.bA.Qr);
            for (var i = this.jA.length - 1; i >= 0; i--) t.extend(this.jA[i].PE());
            return t.extend(this.hA.getBounds()),
                t
        },
        bE: function(t, i) {
            var e, s = this.jA.slice(),
                n = this.KA;
            for (this.bA && this.bA.Ra(s), e = s.length - 1; e >= 0; e--) n.indexOf(s[e]) === -1 && t.call(i, s[e]);
            this.hA.bE(t, i)
        },
        getLayers: function() {
            var t = [];
            return this.bE(function(i) {
                t.push(i)
            }),
                t
        },
        getLayer: function(t) {
            var i = null;
            return t = parseInt(t, 10),
                this.bE(function(e) {
                    T.d(e) === t && (i = e)
                }),
                i
        },
        hasLayer: function(t) {
            if (!t) return ! 1;
            var i, e = this.jA;
            for (i = e.length - 1; i >= 0; i--) if (e[i] === t) return ! 0;
            for (e = this.KA, i = e.length - 1; i >= 0; i--) if (e[i] === t) return ! 1;
            return ! (!t.MA || t.MA.ia !== this) || this.hA.hasLayer(t)
        },
        Oa: function(t, i) {
            "function" != typeof i && (i = function() {});
            var e = function() { ! t.Fr && !t.MA.Fr || this.JA || (this.jE.off("moveend", e, this), this.off("animationend", e, this), t.Fr ? i() : t.MA.Fr && (this.rQ("spiderfied", i, this), t.MA.oa()))
            };
            if (t.Fr && this.jE.getBounds().contains(t.PE())) i();
            else if (t.MA.fW < this.jE.getZoom()) this.jE.on("moveend", e, this),
                this.jE.panTo(t.PE());
            else {
                var s = function() {
                    this.jE.off("movestart", s, this),
                        s = null
                };
                this.jE.on("movestart", s, this),
                    this.jE.on("moveend", e, this),
                    this.on("animationend", e, this),
                    t.MA.Pa(),
                s && e.call(this)
            }
        },
        onAdd: function(t) {
            this.jE = t;
            var i, e, s;
            if (!isFinite(this.jE.getMaxZoom())) throw "Map has no maxZoom specified";
            for (this.HA.addTo(t), this.hA.addTo(t), this.Ya || this.Ia(), this.pa = t.options.IW.projection.QW, i = 0, e = this.KA.length; i < e; i++) s = this.KA[i],
                this.qa(s, !0);
            this.KA = [],
                this.fW = this.jE.getZoom(),
                this.kA = this.Aa(),
                this.jE.on("zoomend", this.aa, this),
                this.jE.on("moveend", this.mw, this),
            this.Sa && this.Sa(),
                this.sa(),
                e = this.jA,
                this.jA = [],
                this.addLayers(e)
        },
        onRemove: function(t) {
            t.off("zoomend", this.aa, this),
                t.off("moveend", this.mw, this),
                this.Da(),
                this.jE.ow.className = this.jE.ow.className.replace(" tdt-cluster-anim", ""),
            this.da && this.da(),
                delete this.pa,
                this.Fa(),
                this.HA.Qq(),
                this.hA.Qq(),
                this.HA.clearLayers(),
                this.jE = null
        },
        fa: function(t) {
            for (var i = t; i && !i.Fr;) i = i.MA;
            return i || null
        },
        mA: function(t, i) {
            for (var e = t.length - 1; e >= 0; e--) if (t[e] === i) return t.splice(e, 1),
                !0
        },
        Ga: function(t, i) {
            for (var e = this.jE,
                     s = this.Ua; i >= 0 && s[i].ga(t, e.nq(t.PE(), i)); i--);
        },
        Wa: function(t) {
            this.Ha || (t.target.or = t.ha, this.removeLayer(t.target), t.target.or = t.KT, this.addLayer(t.target))
        },
        qa: function(t, i, e) {
            var s = this.Ya,
                n = this.Ua,
                o = this.HA,
                h = this.jE;
            i && this.Ga(t, this.vA);
            var r, a = t.MA,
                l = a.LO;
            for (this.mA(l, t); a && (a.Ja--, a.ja = !0, !(a.fW < 0));) i && a.Ja <= 1 ? (r = a.LO[0] === t ? a.LO[1] : a.LO[0], s[a.fW].ga(a, h.nq(a.Ka, a.fW)), n[a.fW].ka(r, h.nq(r.PE(), a.fW)), this.mA(a.MA.La, a), a.MA.LO.push(r), r.MA = a.MA, a.Fr && (o.removeLayer(a), e || o.addLayer(r))) : e && a.Fr || a.Ta(),
                a = a.MA;
            delete t.MA
        },
        la: function(t, i) {
            for (; i;) {
                if (t === i) return ! 0;
                i = i.parentNode
            }
            return ! 1
        },
        wQ: function(t, i, e) {
            if (i && i.layer instanceof T.VA) {
                if (i.originalEvent && this.la(i.layer.Fr, i.originalEvent.relatedTarget)) return;
                t = "cluster" + t
            }
            T.fT.prototype.wQ.call(this, t, i, e)
        },
        EQ: function(t, i) {
            return T.fT.prototype.EQ.call(this, t, i) || T.fT.prototype.EQ.call(this, "cluster" + t, i)
        },
        Za: function(t) {
            var i = t.ea(),
                e = " marker-cluster-";
            return e += i < 10 ? "small1": i < 100 ? "medium1": "large1",
                new T.DivIcon({
                    html: "<div><span>" + i + "</span></div>",
                    className: "marker-cluster" + e,
                    iconSize: new T.Point(40, 40)
                })
        },
        sa: function() {
            var t = this.jE,
                i = this.options.OA,
                e = this.options.oA,
                s = this.options.PA; (i || s) && this.on("clusterclick", this.Ca, this),
            e && (this.on("clustermouseover", this.Va, this), this.on("clustermouseout", this.Fa, this), t.on("zoomend", this.Fa, this))
        },
        Ca: function(t) {
            var i = t.layer,
                e = i;
            return 1 === e.La.length ? void this.jE.centerAndZoom(e.or, this.jE.getZoom() + 1) : (e.fW === this.vA && e.Ja === i.Ja && this.options.OA ? i.oa() : this.options.PA && i.Pa(), void(t.originalEvent && 13 === t.originalEvent.keyCode && this.jE.Ow.focus()))
        },
        Va: function(t) {
            var i = this.jE;
            this.JA || (this.ca && i.removeLayer(this.ca), t.layer.ea() > 2 && t.layer !== this.Ba && (this.ca = new T.Polygon(t.layer.va(), this.options.gA), i.addLayer(this.ca)))
        },
        Fa: function() {
            this.ca && (this.jE.removeLayer(this.ca), this.ca = null)
        },
        Da: function() {
            var t = this.options.OA,
                i = this.options.oA,
                e = this.options.PA,
                s = this.jE; (t || e) && this.off("clusterclick", this.Ca, this),
            i && (this.off("clustermouseover", this.Va, this), this.off("clustermouseout", this.Fa, this), s.off("zoomend", this.Fa, this))
        },
        aa: function() {
            this.jE && (this.Na(), this.fW = Math.round(this.jE.fW), this.kA = this.Aa())
        },
        mw: function() {
            if (!this.JA) {
                var t = this.Aa();
                this.bA.ba(this.kA, this.fW, t),
                    this.bA.ta(null, Math.round(this.jE.fW), t),
                    this.kA = t
            }
        },
        Ia: function() {
            var t = this.jE.getMaxZoom(),
                i = this.options.IA,
                e = i;
            "function" != typeof i && (e = function() {
                return i
            }),
            this.options.AA && (t = this.options.AA - 1),
                this.vA = t,
                this.Ya = {},
                this.Ua = {};
            for (var s = t; s >= 0; s--) this.Ya[s] = new T.Ma(e(s)),
                this.Ua[s] = new T.Ma(e(s));
            this.bA = new this.CA(this, -1)
        },
        Wi: function(t, i) {
            var e, s, n = this.Ya,
                o = this.Ua;
            for (this.options.pA && this.na(t), t.on("move", this.Wa, this); i >= 0; i--) {
                e = this.jE.nq(t.PE(), i);
                var h = n[i]._a(e);
                if (h) return h.ma(t),
                    void(t.MA = h);
                if (h = o[i]._a(e)) {
                    var r = h.MA;
                    r && this.qa(h, !1);
                    var a = new this.CA(this, i, h, t);
                    n[i].ka(a, this.jE.nq(a.Ka, i)),
                        h.MA = a,
                        t.MA = a;
                    var l = a;
                    for (s = i - 1; s > r.fW; s--) l = new this.CA(this, s, l),
                        n[s].ka(l, this.jE.nq(h.PE(), s));
                    return r.ma(l),
                        void this.Ga(h, i)
                }
                o[i].ka(t, e)
            }
            this.bA.ma(t),
                t.MA = this.bA
        },
        QS: function(t) {
            this.LA.push(t),
            this.qS || (this.qS = setTimeout(T.D(this.WS, this), 300))
        },
        WS: function() {
            for (var t = 0; t < this.LA.length; t++) this.LA[t].call(this);
            this.LA.length = 0,
                clearTimeout(this.qS),
                this.qS = null
        },
        Na: function() {
            var t = Math.round(this.jE.fW);
            this.WS(),
                this.fW < t && this.kA.intersects(this.Aa()) ? (this.wS(), this.bA.ba(this.kA, this.fW, this.Aa()), this.ES(this.fW, t)) : this.fW > t ? (this.wS(), this.eS(this.fW, t)) : this.mw()
        },
        Aa: function() {
            return this.options.aA ? T.oQ.mobile ? this.rS(this.jE.getBounds()) : this.rS(this.jE.getBounds().lq(1)) : this.RS
        },
        rS: function(t) {
            var i = this.pa;
            return void 0 !== i && (t.Cq() >= i && (t.Lq.lat = 1 / 0), t.Bq() <= -i && (t.kq.lat = -(1 / 0))),
                t
        },
        _A: function(t, i) {
            if (i === t) this.HA.addLayer(t);
            else if (2 === i.Ja) {
                i.TS();
                var e = i.Ra();
                this.HA.removeLayer(e[0]),
                    this.HA.removeLayer(e[1])
            } else i.Ta()
        },
        Ea: function(t, i) {
            var e, s = t.getLayers(),
                n = 0;
            for (i = i || []; n < s.length; n++) e = s[n],
                e instanceof T.LayerGroup ? this.Ea(e, i) : i.push(e);
            return i
        },
        na: function(t) {
            var i = t.options.icon = this.options.iA({
                ea: function() {
                    return 1
                },
                Ra: function() {
                    return [t]
                }
            });
            return i
        }
    }),
    T.uA.M({
        RS: new T.Kq(new T.dq( - (1 / 0), -(1 / 0)), new T.dq(1 / 0, 1 / 0))
    }),
    T.uA.M({
        ZA: {
            wS: function() {},
            ES: function(t, i) {
                this.bA.ba(this.kA, t),
                    this.bA.ta(null, i, this.Aa()),
                    this.wQ("animationend")
            },
            eS: function(t, i) {
                this.bA.ba(this.kA, t),
                    this.bA.ta(null, i, this.Aa()),
                    this.wQ("animationend")
            },
            nA: function(t, i) {
                this._A(t, i)
            }
        },
        lA: {
            wS: function() {
                this.jE.ow.className += " tdt-cluster-anim",
                    this.JA++
            },
            ES: function(t, i) {
                var e, s = this.Aa(),
                    n = this.HA;
                this.Ha = !0,
                    this.bA.tS(s, t, 0,
                        function(o) {
                            var h, r = o.or,
                                a = o.LO;
                            for (s.contains(r) || (r = null), o.YS() && t + 1 === i ? (n.removeLayer(o), o.ta(null, i, s)) : (o.US(), o.ta(r, i, s)), e = a.length - 1; e >= 0; e--) h = a[e],
                            s.contains(h.or) || n.removeLayer(h)
                        }),
                    this.uS(),
                    this.bA.IS(s, i),
                    n.bE(function(t) {
                        t instanceof T.VA || !t.Fr || t.wa()
                    }),
                    this.bA.tS(s, t, i,
                        function(t) {
                            t.iS(i)
                        }),
                    this.Ha = !1,
                    this.QS(function() {
                        this.bA.tS(s, t, 0,
                            function(t) {
                                n.removeLayer(t),
                                    t.wa()
                            }),
                            this.OS()
                    })
            },
            eS: function(t, i) {
                this.oS(this.bA, t - 1, i),
                    this.bA.ta(null, i, this.Aa()),
                    this.bA.ba(this.kA, t, this.Aa())
            },
            nA: function(t, i) {
                var e = this,
                    s = this.HA;
                s.addLayer(t),
                i !== t && (i.Ja > 2 ? (i.Ta(), this.uS(), this.wS(), t.fr(this.jE.kw(i.PE())), t.US(), this.QS(function() {
                    s.removeLayer(t),
                        t.wa(),
                        e.OS()
                })) : (this.uS(), e.wS(), e.oS(i, this.jE.getMaxZoom(), this.jE.getZoom())))
            }
        },
        oS: function(t, i, e) {
            var s = this.Aa();
            t.PS(s, i + 1, e);
            var n = this;
            this.uS(),
                t.IS(s, e),
                this.QS(function() {
                    if (1 === t.Ja) {
                        var o = t.LO[0];
                        this.Ha = !0,
                            o.sr(o.PE()),
                            this.Ha = !1,
                        o.wa && o.wa()
                    } else t.tS(s, e, 0,
                        function(t) {
                            t.ba(s, i + 1)
                        });
                    n.OS()
                })
        },
        OS: function() {
            this.jE && (this.jE.ow.className = this.jE.ow.className.replace(" tdt-cluster-anim", "")),
                this.JA--,
                this.wQ("animationend")
        },
        uS: function() {
            T.S.H(document.body.offsetWidth)
        }
    }),
    T.pS = function(t) {
        return new T.uA(t)
    },
    T.VA = T.Marker.extend({
        initialize: function(t, i, e, s) {
            T.Marker.prototype.initialize.call(this, e ? e.Ka || e.PE() : new T.dq(0, 0), {
                icon: this
            }),
                this.ia = t,
                this.fW = i,
                this.LO = [],
                this.La = [],
                this.Ja = 0,
                this.ra = !0,
                this.ja = !0,
                this.Qr = new T.Kq,
            e && this.ma(e),
            s && this.ma(s)
        },
        Ra: function(t) {
            t = t || [];
            for (var i = this.La.length - 1; i >= 0; i--) this.La[i].Ra(t);
            for (var e = this.LO.length - 1; e >= 0; e--) t.push(this.LO[e]);
            return t
        },
        ea: function() {
            return this.Ja
        },
        Pa: function() {
            for (var t, i = this.La.slice(), e = this.ia.jE, s = e.nW(this.Qr), n = this.fW + 1, o = e.getZoom(); i.length > 0 && s > n;) {
                n++;
                var h = [];
                for (t = 0; t < i.length; t++) h = h.concat(i[t].La);
                i = h
            }
            s > n ? this.ia.jE.gW(this.or, n) : s <= o ? this.ia.jE.gW(this.or, o + 1) : this.ia.jE._W(this.Qr)
        },
        getBounds: function() {
            var t = new T.Kq;
            return t.extend(this.Qr),
                t
        },
        Ta: function() {
            this.ra = !0,
            this.Fr && this.setIcon(this)
        },
        Rr: function() {
            return this.ra && (this.AS = this.ia.options.iA(this), this.ra = !1),
                this.AS.Rr()
        },
        Tr: function() {
            return this.AS.Tr()
        },
        ma: function(t, i) {
            this.ra = !0,
                this.ja = !0,
                this.aS(t),
                t instanceof T.VA ? (i || (this.La.push(t), t.MA = this), this.Ja += t.Ja) : (i || this.LO.push(t), this.Ja++),
            this.MA && this.MA.ma(t, !0)
        },
        aS: function(t) {
            this.fLatLng || (this.fLatLng = t.or),
            this.Ka || (this.Ka = t.Ka || t.or)
        },
        SS: function() {
            var t = this.Qr;
            t.kq && (t.kq.lat = 1 / 0, t.kq.lng = 1 / 0),
            t.Lq && (t.Lq.lat = -(1 / 0), t.Lq.lng = -(1 / 0))
        },
        NA: function() {
            var t, i, e, s, n = this.LO,
                o = this.La,
                h = 0,
                r = 0,
                a = this.Ja;
            if (0 !== a) {
                for (this.SS(), t = 0; t < n.length; t++) e = n[t].or,
                    this.Qr.extend(e),
                    h += e.lat,
                    r += e.lng;
                for (t = 0; t < o.length; t++) i = o[t],
                i.ja && i.NA(),
                    this.Qr.extend(i.Qr),
                    e = i.sS,
                    s = i.Ja,
                    h += e.lat * s,
                    r += e.lng * s;
                this.or = this.sS = new T.dq(h / a, r / a),
                    this.ja = !1
            }
        },
        TS: function(t) {
            t && (this.DS = this.or, this.sr(t)),
                this.ia.HA.addLayer(this)
        },
        dS: function(t, i, e) {
            this.tS(t, 0, e - 1,
                function(t) {
                    var e, s, n = t.LO;
                    for (e = n.length - 1; e >= 0; e--) s = n[e],
                    s.Fr && (s.fr(i), s.US())
                },
                function(t) {
                    var e, s, n = t.La;
                    for (e = n.length - 1; e >= 0; e--) s = n[e],
                    s.Fr && (s.fr(i), s.US())
                })
        },
        PS: function(t, i, e) {
            this.tS(t, e, 0,
                function(s) {
                    s.dS(t, s.ia.jE.kw(s.PE()).hQ(), i),
                        s.YS() && i - 1 === e ? (s.wa(), s.ba(t, i)) : s.US(),
                        s.TS()
                })
        },
        IS: function(t, i) {
            this.tS(t, 0, i, null,
                function(t) {
                    t.wa()
                })
        },
        ta: function(t, i, e) {
            this.tS(e, -1, i,
                function(s) {
                    if (i !== s.fW) for (var n = s.LO.length - 1; n >= 0; n--) {
                        var o = s.LO[n];
                        e.contains(o.or) && (t && (o.DS = o.PE(), o.sr(t), o.US && o.US()), s.ia.HA.addLayer(o))
                    }
                },
                function(i) {
                    i.TS(t)
                })
        },
        iS: function(t) {
            for (var i = this.LO.length - 1; i >= 0; i--) {
                var e = this.LO[i];
                e.DS && (e.sr(e.DS), delete e.DS)
            }
            if (t - 1 === this.fW) for (var s = this.La.length - 1; s >= 0; s--) this.La[s].FS();
            else for (var n = this.La.length - 1; n >= 0; n--) this.La[n].iS(t)
        },
        FS: function() {
            this.DS && (this.sr(this.DS), delete this.DS)
        },
        ba: function(t, i, e) {
            var s, n;
            this.tS(t, -1, i - 1,
                function(t) {
                    for (n = t.LO.length - 1; n >= 0; n--) s = t.LO[n],
                    e && e.contains(s.or) || (t.ia.HA.removeLayer(s), s.wa && s.wa())
                },
                function(t) {
                    for (n = t.La.length - 1; n >= 0; n--) s = t.La[n],
                    e && e.contains(s.or) || (t.ia.HA.removeLayer(s), s.wa && s.wa())
                })
        },
        tS: function(t, i, e, s, n) {
            var o, h, r = this.La,
                a = this.fW;
            if (i > a) for (o = r.length - 1; o >= 0; o--) h = r[o],
            t.intersects(h.Qr) && h.tS(t, i, e, s, n);
            else if (s && s(this), n && this.fW === e && n(this), e > a) for (o = r.length - 1; o >= 0; o--) h = r[o],
            t.intersects(h.Qr) && h.tS(t, i, e, s, n)
        },
        YS: function() {
            return this.La.length > 0 && this.La[0].Ja === this.Ja
        }
    }),
    T.Marker.M({
        US: function() {
            return this.options.fS = this.options.opacity || 1,
                this.setOpacity(0)
        },
        wa: function() {
            var t = this.setOpacity(this.options.opacity || this.options.fS);
            return delete this.options.fS,
                t
        }
    }),
    T.Ma = function(t) {
        this.GS = t,
            this.gS = t * t,
            this.HS = {},
            this.hS = {}
    },
    T.Ma.prototype = {
        ka: function(t, i) {
            var e = this.JS(i.x),
                s = this.JS(i.y),
                n = this.HS,
                o = n[s] = n[s] || {},
                h = o[e] = o[e] || [],
                r = T.S.d(t);
            this.hS[r] = i,
                h.push(t)
        },
        jS: function(t, i) {
            this.ga(t),
                this.ka(t, i)
        },
        ga: function(t, i) {
            var e, s, n = this.JS(i.x),
                o = this.JS(i.y),
                h = this.HS,
                r = h[o] = h[o] || {},
                a = r[n] = r[n] || [];
            for (delete this.hS[T.S.d(t)], e = 0, s = a.length; e < s; e++) if (a[e] === t) return a.splice(e, 1),
            1 === s && delete r[n],
                !0
        },
        KS: function(t, i) {
            var e, s, n, o, h, r, a, l = this.HS;
            for (e in l) {
                h = l[e];
                for (s in h) for (r = h[s], n = 0, o = r.length; n < o; n++) a = t.call(i, r[n]),
                a && (n--, o--)
            }
        },
        _a: function(t) {
            var i, e, s, n, o, h, r, a, l = this.JS(t.x),
                u = this.JS(t.y),
                c = this.hS,
                f = this.gS,
                d = null;
            for (i = u - 1; i <= u + 1; i++) if (n = this.HS[i]) for (e = l - 1; e <= l + 1; e++) if (o = n[e]) for (s = 0, h = o.length; s < h; s++) r = o[s],
                a = this.at(c[T.S.d(r)], t),
            a < f && (f = a, d = r);
            return d
        },
        JS: function(t) {
            return Math.floor(t / this.GS)
        },
        at: function(t, i) {
            var e = i.x - t.x,
                s = i.y - t.y;
            return e * e + s * s
        }
    },
    function() {
        T.kS = {
            getDistant: function(t, i) {
                var e = i[1].lat - i[0].lat,
                    s = i[0].lng - i[1].lng;
                return s * (t.lat - i[0].lat) + e * (t.lng - i[0].lng)
            },
            LS: function(t, i) {
                var e, s, n, o = 0,
                    h = null,
                    r = [];
                for (e = i.length - 1; e >= 0; e--) s = i[e],
                    n = this.getDistant(s, t),
                n > 0 && (r.push(s), n > o && (o = n, h = s));
                return {
                    maxPoint: h,
                    newPoints: r
                }
            },
            lS: function(t, i) {
                var e = [],
                    s = this.LS(t, i);
                return s.maxPoint ? (e = e.concat(this.lS([t[0], s.maxPoint], s.newPoints)), e = e.concat(this.lS([s.maxPoint, t[1]], s.newPoints))) : [t[0]]
            },
            va: function(t) {
                var i, e = !1,
                    s = !1,
                    n = !1,
                    o = !1,
                    h = null,
                    r = null,
                    a = null,
                    l = null,
                    u = null,
                    c = null;
                for (i = t.length - 1; i >= 0; i--) {
                    var f = t[i]; (e === !1 || f.lat > e) && (h = f, e = f.lat),
                    (s === !1 || f.lat < s) && (r = f, s = f.lat),
                    (n === !1 || f.lng > n) && (a = f, n = f.lng),
                    (o === !1 || f.lng < o) && (l = f, o = f.lng)
                }
                s !== e ? (c = r, u = h) : (c = l, u = a);
                var T = [].concat(this.lS([c, u], t), this.lS([u, c], t));
                return T
            }
        }
    } (),
    T.VA.M({
        va: function() {
            var t, i, e = this.Ra(),
                s = [];
            for (i = e.length - 1; i >= 0; i--) t = e[i].PE(),
                s.push(t);
            return T.kS.va(s)
        }
    }),
    T.VA.M({
        ZS: 2 * Math.PI,
        CS: 25,
        VS: Math.PI / 6,
        cS: 28,
        BS: 11,
        vS: 5,
        NS: 9,
        oa: function() {
            if (this.ia.Ba !== this && !this.ia.JA) {
                var t, i = this.Ra(),
                    e = this.ia,
                    s = e.jE,
                    n = s.kw(this.or);
                this.ia.BA(),
                    this.ia.Ba = this,
                    i.length >= this.NS ? t = this.bS(i.length, n) : (n.y += 10, t = this.MS(i.length, n)),
                    this.nS(i, t)
            }
        },
        _S: function(t) {
            this.ia.JA || (this.mS(t), this.ia.Ba = null)
        },
        MS: function(t, i) {
            var e, s, n = this.ia.options.sA * this.CS * (2 + t),
                o = n / this.ZS,
                h = this.ZS / t,
                r = [];
            for (r.length = t, e = t - 1; e >= 0; e--) s = this.VS + e * h,
                r[e] = new T.Point(i.x + o * Math.cos(s), i.y + o * Math.sin(s)).JQ();
            return r
        },
        bS: function(t, i) {
            var e, s = this.ia.options.sA,
                n = s * this.BS,
                o = s * this.cS,
                h = s * this.vS * this.ZS,
                r = 0,
                a = [];
            for (a.length = t, e = t - 1; e >= 0; e--) r += o / n + 5e-4 * e,
                a[e] = new T.Point(i.x + n * Math.cos(r), i.y + n * Math.sin(r)).JQ(),
                n += h / r;
            return a
        },
        ua: function() {
            var t, i, e = this.ia,
                s = e.jE,
                n = e.HA,
                o = this.Ra();
            for (e.Ha = !0, this.setOpacity(1), i = o.length - 1; i >= 0; i--) t = o[i],
                n.removeLayer(t),
            t.Qs && (t.sr(t.Qs), delete t.Qs),
            t.setZIndexOffset && t.setZIndexOffset(0),
            t.qs && (s.removeLayer(t.qs), delete t.qs);
            e.wQ("Ws", {
                cluster: this,
                markers: o
            }),
                e.Ha = !1,
                e.Ba = null
        }
    }),
    T.cA = T.VA.extend({
        nS: function(t, i) {
            var e, s, n, o, h = this.ia,
                r = h.jE,
                a = h.HA,
                l = this.ia.options.DA;
            for (h.Ha = !0, e = 0; e < t.length; e++) o = r.Dw(i[e]),
                s = t[e],
                n = new T.Polyline([this.or, o], l),
                r.addLayer(n),
                s.qs = n,
                s.Qs = s.or,
                s.sr(o),
            s.setZIndexOffset && s.setZIndexOffset(1e6),
                a.addLayer(s);
            this.setOpacity(.3),
                h.Ha = !1,
                h.wQ("spiderfied", {
                    cluster: this,
                    markers: t
                })
        },
        mS: function() {
            this.ua()
        }
    }),
    T.VA.M({
        nS: function(t, i) {
            var e, s, n, o, h, r, a = this,
                l = this.ia,
                u = l.jE,
                c = l.HA,
                f = this.or,
                d = u.kw(f),
                p = T.jT.SVG,
                m = T.extend({},
                    this.ia.options.DA),
                y = m.opacity;
            for (void 0 === y && (y = T.uA.prototype.options.DA.opacity), p ? (m.opacity = 0, m.className = (m.className || "") + " tdt-cluster-spider-leg") : m.opacity = y, l.Ha = !0, e = 0; e < t.length; e++) s = t[e],
                r = u.Dw(i[e]),
                n = new T.Polyline([f, r], m),
                u.addLayer(n),
                s.qs = n,
            p && (o = n.Yt, h = o.getTotalLength() + .1, o.style.strokeDasharray = h, o.style.strokeDashoffset = h),
            s.setZIndexOffset && s.setZIndexOffset(1e6),
            s.US && s.US(),
                c.addLayer(s),
            s.fr && s.fr(d);
            for (l.uS(), l.wS(), e = t.length - 1; e >= 0; e--) r = u.Dw(i[e]),
                s = t[e],
                s.Qs = s.or,
                s.sr(r),
            s.wa && s.wa(),
            p && (n = s.qs, o = n.Yt, o.style.strokeDashoffset = 0, n.setStyle({
                opacity: y
            }));
            this.setOpacity(.3),
                l.Ha = !1,
                setTimeout(function() {
                        l.OS(),
                            l.wQ("spiderfied", {
                                cluster: a,
                                markers: t
                            })
                    },
                    200)
        },
        mS: function(t) {
            var i, e, s, n, o, h, r = this,
                a = this.ia,
                l = a.jE,
                u = a.HA,
                c = t ? l.DE(this.or, t.zoom, t.center) : l.kw(this.or),
                f = this.Ra(),
                d = T.jT.SVG;
            for (a.Ha = !0, a.wS(), this.setOpacity(1), e = f.length - 1; e >= 0; e--) i = f[e],
            i.Qs && (i.sr(i.Qs), delete i.Qs, h = !0, i.fr && (i.fr(c), h = !1), i.US && (i.US(), h = !1), h && u.removeLayer(i), d && (s = i.qs, n = s.Yt, o = n.getTotalLength() + .1, n.style.strokeDashoffset = o, s.setStyle({
                opacity: 0
            })));
            a.Ha = !1,
                setTimeout(function() {
                        var t = 0;
                        for (e = f.length - 1; e >= 0; e--) i = f[e],
                        i.qs && t++;
                        for (e = f.length - 1; e >= 0; e--) i = f[e],
                        i.qs && (i.wa && i.wa(), i.setZIndexOffset && i.setZIndexOffset(0), t > 1 && u.removeLayer(i), l.removeLayer(i.qs), delete i.qs);
                        a.OS(),
                            a.wQ("Ws", {
                                cluster: r,
                                markers: f
                            })
                    },
                    200)
        }
    }),
    T.uA.M({
        Ba: null,
        _S: function() {
            this.BA.apply(this, arguments)
        },
        Sa: function() {
            this.jE.on("click", this.ws, this),
            this.jE.options.Nr && this.jE.on("zoomstart", this.Es, this),
                this.jE.on("zoomend", this.ua, this),
            T.oQ.touch || this.jE.vT(this)
        },
        da: function() {
            this.jE.off("click", this.ws, this),
                this.jE.off("zoomstart", this.Es, this),
                this.jE.off("Ge", this.es, this),
                this.jE.off("zoomend", this.ua, this),
                this.ua()
        },
        Es: function() {
            this.jE && this.jE.on("Ge", this.es, this)
        },
        es: function(t) {
            T._Q.Eq(this.jE.ow, "tdt-touching") || (this.jE.off("Ge", this.es, this), this.BA(t))
        },
        ws: function() {
            this.BA()
        },
        BA: function(t) {
            this.Ba && this.Ba._S(t)
        },
        ua: function() {
            this.Ba && this.Ba.ua()
        },
        Qa: function(t) {
            t.qs && (this.HA.removeLayer(t), t.wa && t.wa(), t.setZIndexOffset && t.setZIndexOffset(0), this.jE.removeLayer(t.qs), delete t.qs)
        }
    }),
    T.uA.M({
        Rs: function(t) {
            return t ? t instanceof T.uA ? t = t.bA.Ra() : t instanceof T.LayerGroup ? t = t.hW: t instanceof T.VA ? t = t.Ra() : t instanceof T.Marker && (t = [t]) : t = this.bA.Ra(),
                this.rs(t),
                this.Ts(),
            this.options.pA && this.ts(t),
                this
        },
        rs: function(t) {
            var i, e;
            for (i in t) for (e = t[i].MA; e;) e.ra = !0,
                e = e.MA
        },
        Ts: function() {
            this.HA.bE(function(t) {
                t instanceof T.VA && t.ra && t.Ta()
            })
        },
        ts: function(t) {
            var i, e;
            for (i in t) e = t[i],
            this.hasLayer(e) && e.setIcon(this.na(e))
        }
    }),
    T.Marker.M({
        Ys: function(t, i) {
            var e = this.options.icon;
            return T.setOptions(e, t),
                this.setIcon(e),
            i && this.MA && this.MA.ia.Rs(this),
                this
        }
    }),
    T.Us = T.DivIcon.extend({
        options: {
            url: "",
            size: [12, 12],
            offset: [],
            textColor: "#ff00ff",
            textSize: 10
        },
        initialize: function(t) {
            t && (t.bgPos && (this.options.bgPos = t.offset), t.size && (this.options.iconSize = t.size), t.textColor && (this.options.textColor = t.textColor), t.textSize && (this.options.textSize = t.textSize), t.url && (this.options.url = t.url)),
                this.options.className = "tdt-cluster0",
                T.DivIcon.prototype.initialize.call(this, t)
        },
        er: function(t, i) {
            T.DivIcon.prototype.er.call(this, t, i),
                t.className = this.options.className || "",
            this.options.url && (t.style.backgroundImage = "url(" + this.options.url + ")"),
            this.options.textColor && (t.style.color = this.options.textColor),
            this.options.textSize && (t.style.fontSize = this.options.textSize + "pt"),
                t.style.lineHeight = t.style.height
        }
    }),
    T.MarkerClusterer = T.uA.extend({
        options: {
            markers: {},
            girdSize: 60,
            maxZoom: 30,
            minClusterSize: 2,
            isAverangeCenter: !1,
            styles: [{
                url: T.w.E + "/img/map/cluster/cluster0.png",
                size: [42, 42],
                offset: new T.Point( - 15, -13),
                textColor: "#000000",
                textSize: 8,
                range: [0, 80]
            },
                {
                    url: T.w.E + "/img/map/cluster/cluster1.png",
                    size: [42, 42],
                    offset: new T.Point( - 20, -17),
                    textColor: "#ffffff",
                    textSize: 10,
                    range: [80, 200]
                },
                {
                    url: T.w.E + "/img/map/cluster/cluster2.png",
                    size: [45, 45],
                    soffset: new T.Point( - 10, -22),
                    textColor: "#000000",
                    textSize: 10,
                    range: [200, 500]
                },
                {
                    url: T.w.E + "/img/map/cluster/cluster3.png",
                    size: [50, 50],
                    soffset: new T.Point( - 10, -22),
                    textColor: "#ffffff",
                    textSize: 10,
                    range: [500, 1e3]
                },
                {
                    url: T.w.E + "/img/map/cluster/cluster4.png",
                    size: [55, 55],
                    soffset: new T.Point( - 10, -22),
                    textColor: "#000000",
                    textSize: 10,
                    range: [1e3]
                }]
        },
        initialize: function(t, i) {
            T.S.setOptions(this, i),
            i && i.minClusterSize && (this.options.styles = i.styles),
                T.uA.prototype.initialize.call(this, i),
            i.markers && this.addLayers(i.markers),
                this.options.oA = !1,
                t.addLayer(this),
                t.on("zoomend moveend", this._viewChangeEndNotClustering, this)
        },
        _viewChangeEndNotClustering: function() {
            var t = this.HA,
                i = this.Aa(),
                e = this.options.minClusterSize,
                s = this.options.isAverangeCenter;
            targetZoom = this.fW,
                t.bE(function(i) {
                    t.removeLayer(i)
                }),
                this.bA.tS(i, -1, targetZoom,
                    function(i) {
                        if (i.fW !== targetZoom) for (var e, s = i.LO,
                                                          n = 0; n < s.length; n++) e = i.LO[n],
                            t.addLayer(e)
                    },
                    function(i) {
                        if (s ? i.sr(i.getBounds().getCenter()) : i.sr(i.fLatLng), i.Ja < e) for (var n = i.Ra(), o = 0; o < n.length; o++) t.addLayer(n[o]);
                        else i.TS()
                    })
        },
        addMarker: function(t) {
            return this.addLayer(t),
                this
        },
        addMarkers: function(t) {
            return this.addLayers(t),
                this
        },
        clearMarkers: function() {
            return this.clearLayers(),
                this
        },
        getClustersCount: function() {
            return markers && markers.HA && markers.HA.getLayers() ? markers.HA.getLayers().length: 0
        },
        getGridSize: function() {
            return this.options.IA
        },
        getMarkers: function() {
            return markers.HA.getLayers()
        },
        getMaxZoom: function() {
            return this.options.AA
        },
        getStyles: function() {
            return this.options.styles
        },
        isAverageCenter: function() {},
        removeMarker: function(t) {
            return this.removeLayer(t),
                this
        },
        removeMarkers: function(t) {
            return this.removeLayers(t),
                this
        },
        setGridSize: function(t) {
            this.options.IA = t;
            var i = this.getLayers().splice(0);
            return this.clearMarkers(),
                this.addMarkers(i),
                this
        },
        setMaxZoom: function(t) {
            this.options.AA = t;
            var i = this.getLayers().splice(0);
            return this.clearMarkers(),
                this.addMarkers(i),
                this
        },
        setMinClusterSize: function(t) {},
        setStyles: function(t, i) {
            this.options.styles = t,
            t && (this.options.iA = function(i) {
                var e = {};
                for (e.childCount = childCount = i.ea(), k = 0; k < t.length; k++) {
                    var s = t[k];
                    if (2 == s.range.length && s.range[0] <= childCount && childCount <= s.range[1]) {
                        e = s,
                            e.childCount = childCount,
                            e.iconSize = s.size;
                        break
                    }
                    if (1 == s.range.length && childCount > s.range[0]) {
                        e = s,
                            e.childCount = childCount,
                            e.iconSize = s.size;
                        break
                    }
                }
                var n = "<div><span >" + childCount + "</span></div>";
                return e.html = n,
                    new T.Us(e)
            },
            i || this.Rs())
        }
    }),
    T.Map.ContextMenu = T.Kr.extend({
        Tu: T.oQ.msPointer ? "MSPointerDown": T.oQ.pointer ? "pointerdown": "touchstart",
        v: {
            us: "tdt-contextmenu"
        },
        initialize: function(t) {
            T.Kr.prototype.initialize.call(this, t),
            this.Is || (this.Is = []),
                this.is = !1;
            var i = this.Ow = T._Q.s("div", T.Map.ContextMenu.us, t.Ow);
            i.style.zIndex = 1e4,
                i.style.position = "absolute",
            t.options.Os && (i.style.width = t.options.Os + "px"),
                this.os(),
                T.oq.on(i, "click", T.oq.uw).on(i, "mousedown", T.oq.uw).on(i, "dblclick", T.oq.uw).on(i, "contextmenu", T.oq.uw)
        },
        oU: function() {
            T.oq.on(document, "keydown", this.QI, this),
                this.jE.on({
                        contextmenu: this.Ps,
                        mousedown: this.ps,
                        movestart: this.ps,
                        zoomstart: this.ps
                    },
                    this),
                T.oq.on(this.jE.getContainer(), "mouseleave", this.ps, this)
        },
        Ar: function() {
            T.oq.off(document, "keydown", this.QI, this),
                this.jE.off({
                        contextmenu: this.Ps,
                        mousedown: this.ps,
                        movestart: this.ps,
                        zoomstart: this.ps
                    },
                    this),
                T.oq.off(this.jE.getContainer(), "mouseleave", this.ps, this)
        },
        As: function(t, i) {
            t instanceof T.dq && (t = this.jE.BW(t)),
                this.as(t, i)
        },
        hide: function() {
            this.ps()
        },
        addItem: function(t) {
            if (this.Ow) this.Ss(t);
            else if ("-" != t) {
                var i = new T.MenuItem(t.text, t.callback);
                i.ss = 0,
                this.Ds || (this.Ds = []),
                    this.Ds.push(i)
            } else this.Ds.push(t)
        },
        Ss: function(t, i) {
            this.Is || (this.Is = []),
                i = void 0 !== i ? i: this.Is.length;
            var e = this.ds(this.Ow, t, i);
            return this.Is.push(e),
                this.kW = !0,
                this.jE.wQ("contextmenu.additem", {
                    contextmenu: this,
                    el: e.el,
                    index: i
                }),
                e.el
        },
        removeItem: function(t) {
            var i = this.Ow;
            isNaN(t) || (t = i.children[t]),
            t && (this.Fs(T.S.d(t)), this.kW = !0, this.jE.wQ("contextmenu.removeitem", {
                contextmenu: this,
                el: t
            }))
        },
        fs: function() {
            for (var t; this.Ow.children.length;) t = this.Ow.children[0],
                this.Fs(T.S.d(t))
        },
        Gs: function() {
            var t, i, e;
            for (i = 0, e = this.Is.length; i < e; i++) t = this.Is[i],
                t.el.style.display = "none"
        },
        gs: function() {
            var t, i, e;
            for (i = 0, e = this.Is.length; i < e; i++) t = this.Is[i],
                t.el.style.display = ""
        },
        Hs: function(t, i) {
            var e = this.Ow,
                s = T.Map.ContextMenu.us + "-item";
            isNaN(t) || (t = e.children[t]),
            t && T._Q.Eq(t, s) && (i ? (T._Q.Rq(t, s + "-disabled"), this.jE.wQ("contextmenu.disableitem", {
                contextmenu: this,
                el: t
            })) : (T._Q.Tq(t, s + "-disabled"), this.jE.wQ("contextmenu.enableitem", {
                contextmenu: this,
                el: t
            })))
        },
        hs: function() {
            return this.is
        },
        os: function() {
            this.Ds || (this.Ds = []);
            var t, i, e = this.Ds;
            for (t = 0, i = e.length; t < i; t++) this.Is.push(this.ds(this.Ow, e[t]))
        },
        ds: function(t, i, e) {
            var s = new T.MenuItem;
            if (s.text = i.text, i.separator || "-" === i) return this.Js(t, e);
            var n = T.Map.ContextMenu.us + "-item",
                o = i.disabled ? n + " " + n + "-disabled": n,
                h = this.js("a", o, t, e),
                r = this.Ks(h, i.callback, i.context, i.ks),
                a = "";
            return i.icon ? a = "<img class='" + T.Map.ContextMenu.us + "-icon' src='" + i.icon + "'/>": i.Ls && (a = "<span class='" + T.Map.ContextMenu.us + "-icon " + i.Ls + "'></span>"),
                h.innerHTML = a + s.text,
                h.href = "#",
                s.el = h,
                T.oq.on(h, "mouseover", this.ls, this.el).on(h, "mouseout", this.Zs, this.el).on(h, "mousedown", T.oq.stopPropagation).on(h, "click", r),
                s.id = T.S.d(h),
                s.callback = r,
                s.ss = 0,
                s.Cs(i.isable),
                s
        },
        Fs: function(t) {
            var i, e, s, n;
            for (s = 0, n = this.Is.length; s < n; s++) if (i = this.Is[s], i.id === t) return e = i.el,
                callback = i.callback,
            callback && T.oq.off(e, "mouseover", this.ls, this).off(e, "mouseover", this.Zs, this).off(e, "mousedown", T.oq.stopPropagation).off(e, "click", i.callback),
                this.Ow.removeChild(e),
                this.Is.splice(s, 1),
                i;
            return null
        },
        Js: function(t, i) {
            var e = new T.MenuItem,
                s = this.js("div", T.Map.ContextMenu.us + "-separator", t, i);
            return e.el = s,
                e.id = T.S.d(s),
                e.text = "-",
                e.ss = 1,
                e
        },
        Ks: function(t, i, e, s) {
            var n = this,
                o = this.jE,
                h = T.Map.ContextMenu.us + "-item-disabled",
                s = void 0 === s || s;
            return function(r) {
                T._Q.Eq(t, h) || (s && n.ps(), i && i.call(e || o, n.Vs.lnglat), n.jE.wQ("contextmenu:select", {
                    contextmenu: n,
                    el: t
                }))
            }
        },
        js: function(t, i, e, s) {
            var n, o = document.createElement(t);
            return o.className = i,
            void 0 !== s && (n = e.children[s]),
                n ? e.insertBefore(o, n) : e.appendChild(o),
                o
        },
        Ps: function(t) {
            this.as(t.containerPoint)
        },
        as: function(t, i) {
            if (this.Is.length) {
                for (var e = this.jE,
                         s = e.Lw(t), n = e.layerPointToLngLat(s), o = {
                        contextmenu: this
                    },
                         h = 0; h < this.Is.length; h++) this.Is[h].cs = n;
                i && (o = T.extend(i, o)),
                    this.Vs = {
                        lnglat: n
                    },
                    this.bP(t),
                    this.is ? this.bP(t) : (this.Ow.style.display = "block", this.is = !0),
                    this.jE.wQ("contextmenu.show", o)
            }
        },
        ps: function() {
            this.is && (this.is = !1, this.Ow.style.display = "none", this.jE.wQ("contextmenu.hide", {
                contextmenu: this
            }))
        },
        bP: function(t) {
            var i, e = this.jE.getSize(),
                s = this.Ow,
                n = this.Bs(s);
            this.jE.options.vs && (i = T.SQ(this.jE.options.vs), t = t.AQ(i)),
                s._tdt_pos = t,
                t.x + n.x > e.x ? (s.style.left = "auto", s.style.right = Math.max(e.x - t.x, 0) + "px") : (s.style.left = Math.max(t.x, 0) + "px", s.style.right = "auto"),
                t.y + n.y > e.y ? (s.style.top = "auto", s.style.bottom = Math.max(e.y - t.y, 0) + "px") : (s.style.top = Math.max(t.y, 0) + "px", s.style.bottom = "auto")
        },
        Bs: function(t) {
            var i = this.Hw,
                e = t.style.display;
            return i && !this.kW || (i = {},
                t.style.left = "-999999px", t.style.right = "auto", t.style.display = "block", i.x = t.offsetWidth, i.y = t.offsetHeight, t.style.left = "auto", t.style.display = e, this.kW = !1),
                i
        },
        nu: function(t) {
            this.ps()
        },
        QI: function(t) {
            var i = t.keyCode;
            27 === i && this.ps()
        },
        ls: function(t) {
            T._Q.Rq(t.target || t.srcElement, "over")
        },
        Zs: function(t) {
            T._Q.Tq(t.target || t.srcElement, "over")
        }
    }),
    T.MenuItem = T.c.extend({
        initialize: function(t, i, e) {
            this.text = t,
                this.callback = i,
            e && (this.weight = e.weight, this.icon = e.icon),
                this.ss = 0,
                this.isable = !0
        },
        setText: function(t) {
            if (1 != this.ss) return this.text = t,
            this.el && (this.el.innerHTML = this.text, T._Q.Rq(this.el, "tdt-contextmenu-item"), T.oq.on(this.el, "mouseover", this.ls, this.el).on(this.el, "mouseout", this.Zs, this.el)),
                this
        },
        ls: function(t) {
            T._Q.Rq(this, "over")
        },
        Zs: function(t) {
            T._Q.Tq(this, "over")
        },
        setCallback: function(t) {
            return this.el && (this.callback && T.oq.off(this.el, "click", this.callback), this.callback = this.Ks(this.el, t), T.oq.on(this.el, "click", this.callback, this)),
                this.callback = t,
                this
        },
        Ks: function(t, i) {
            return function() {
                this.cs && i(this.cs)
            }
        },
        enable: function() {
            return this.isable = !0,
                this.Cs(this.isable),
                this
        },
        disable: function() {
            return this.isable = !1,
                this.Cs(this.isable),
                this
        },
        setIcon: function(t) {
            var t;
            return this.el && (t && (html = "<img class='" + T.Map.ContextMenu.us + "-icon' src='" + t + "'/>"), this.el.innerHTML = html + this.text),
                this
        },
        Cs: function(t) {
            var i = T.Map.ContextMenu.us + "-item",
                e = this.el;
            e && e && T._Q.Eq(e, i) && (t ? T._Q.Tq(e, i + "-disabled") : T._Q.Rq(e, i + "-disabled"))
        }
    }),
    T.ContextMenu = T.Map.ContextMenu.extend({
        includes: T.iQ.OQ,
        options: {
            width: 120,
            Items: []
        },
        initialize: function(t, i) {
            t.width && (this.options.width = t.width),
            t.Items && (this.options.Items = t.Items),
            i && this.Ns(i, this.options)
        },
        as: function(t, i) {
            T.Map.ContextMenu.prototype.as.call(this, t, i),
            this.Is.length && this.wQ("open", {
                pixel: t
            })
        },
        ps: function() {
            T.Map.ContextMenu.prototype.ps.call(this),
            this.is && this.wQ("close")
        },
        Ns: function(t, i) {
            t.options.contextmenu = !0,
                t.options.Os = this.options.width,
                t.options.Ds = this.options.Items,
                T.Map.ContextMenu.prototype.initialize.call(this, t),
                this.Is = this.getItems(),
                this.enable()
        },
        getItem: function(t) {
            var i = this.getItems();
            return i[t]
        },
        removeItem: function(t) {
            t.hasOwnProperty("el") ? T.Map.ContextMenu.prototype.removeItem.call(this, t.el) : T.Map.ContextMenu.prototype.removeItem.call(this, t)
        },
        addSeparator: function() {
            this.addItem("-")
        },
        removeSeparator: function(t) {
            for (var i = 0,
                     e = 0; this.Is[i];) 1 == this.Is[i].ss && (e == t && this.removeItem(i), e++),
                i++
        },
        getItems: function() {
            var t;
            t = this.Is ? this.Is: this.Ds;
            var i = [];
            if (this.Is) for (index = 0; index < t.length; index++) 0 == this.Is[index].ss && (t[index].text = t[index].el.text, i.push(t[index])),
            1 == this.Is[index].ss && (t[index].text = "-");
            else i = t;
            return i
        },
        getAllSeparator: function() {
            var t = this.Is,
                i = new Array;
            for (index = 0; index < t.length; index++) 1 == this.Is[index].ss && i.push(t[index]);
            return i
        }
    }),
    T.Map.M({
        addContextMenu: function(t, i) {
            t.Ns(this, i)
        }
    }),
    T.CoordinatePickup = T.Kr.extend({
        options: {},
        initialize: function(t, i) {
            this.jE = t,
            i && i.callback && (this.callback = i.callback)
        },
        oU: function() {
            this.jE.on("click", this._onEvent, this)
        },
        Ar: function() {
            this.jE.off("click", this._onEvent, this)
        },
        _onEvent: function(t) {
            var i = t.lnglat;
            this.callback(i)
        },
        enable: function() {
            this.jE && this.callback && (this.eU || T.Kr.prototype.enable.call(this))
        },
        disable: function() {
            this.eU && T.Kr.prototype.disable.call(this)
        },
        addEvent: function() {
            this.enable()
        },
        removeEvent: function() {
            this.disable()
        }
    }),
    window.TDT_POINT_SIZE_TINY = "TINY",
    window.TDT_POINT_SIZE_SMALLER = "SMALLER",
    window.TDT_POINT_SIZE_SMALL = "SMALL",
    window.TDT_POINT_SIZE_NORMAL = "NORMAL",
    window.TDT_POINT_SIZE_BIG = "BIG",
    window.TDT_POINT_SIZE_BIGGER = "BIGGER",
    window.TDT_POINT_SIZE_HUGE = "HUGE",
    window.TDT_POINT_SHAPE_CIRCLE = "CIRCLE",
    window.TDT_POINT_SHAPE_STAR = "STAR",
    window.TDT_POINT_SHAPE_SQUARE = "SQUARE",
    window.TDT_POINT_SHAPE_RHOMBUS = "RHOMBUS",
    window.TDT_POINT_SHAPE_WATERDROP = "WATERDROP",
    T.CloudMarker = T.jT.extend({
        options: {
            fill: !0,
            size: 1,
            weight: 0,
            fillOpacity: .6,
            shape: 0,
            zindex: 0
        },
        initialize: function(t, i) {
            T.setOptions(this, i),
                this.or = T.fq(t),
                this.Hw = this.options.size
        },
        onRemove: function() {
            this.bT.et(this)
        },
        sr: function(t) {
            return this.or = T.fq(t),
                this.redraw(),
                this.wQ("move", {
                    KT: this.or
                })
        },
        PE: function() {
            return this.or
        },
        setStyle: function(t) {
            return T.setOptions(this, t),
                T.jT.prototype.setStyle.call(this, t),
                this
        },
        Rt: function() {
            this.eY = this.jE.kw(this.or),
                this.RY()
        },
        Oe: function() {
            this.jE && this.rt()
        },
        rt: function() {
            0 == this.options.shape ? this.bT._updatePaths(this, this._updatePath_circles) : 1 == this.options.shape ? this.bT._updatePaths(this, this._updatePath_rects) : 2 == this.options.shape ? this.bT._updatePaths(this, this._updatePath_diamonds) : 3 == this.options.shape ? this.bT._updatePaths(this, this._updatePath_stars) : 4 == this.options.shape && this.bT._updatePaths(this, this._updatePath_w)
        },
        _updatePath_rects: function(t, i, e) {
            t.beginPath(),
                t.moveTo(i.x - e / 2, i.y - e / 2),
                t.lineTo(i.x - e / 2, i.y + e / 2),
                t.lineTo(i.x + e / 2, i.y + e / 2),
                t.lineTo(i.x + e / 2, i.y - e / 2),
                t.closePath()
        },
        _updatePath_diamonds: function(t, i, e) {
            t.beginPath(),
                t.moveTo(i.x, i.y - e / 2),
                t.lineTo(i.x - e / 2, i.y),
                t.lineTo(i.x, i.y + e / 2),
                t.lineTo(i.x + e / 2, i.y),
                t.closePath()
        },
        _updatePath_circles: function(t, i, e) {
            t.beginPath(),
                t.arc(i.x, i.y, e / 2, 0, 2 * Math.PI, !1),
                t.closePath()
        },
        _updatePath_w: function(t, i, e) {
            t.beginPath(),
                e = e / 4 * 3;
            var s = i.x,
                n = i.y - e / 4,
                o = e / 2,
                h = e;
            t.moveTo(s, n - o),
                t.bezierCurveTo(s - o, n - o, s - 3 * o / 2, n + o / 3, s, n + h),
                t.bezierCurveTo(s + 3 * o / 2, n + o / 3, s + o, n - o, s, n - o),
                t.closePath()
        },
        _updatePath_stars: function(context, p, l) {
            var x = p.x,
                y = p.y - l / 8;
            l = 3 * l / 8;
            var rad1 = Math.sin(.4 * Math.PI),
                rad2 = Math.cos(.4 * Math.PI),
                rad3 = Math.sin(.2 * Math.PI),
                rad4 = Math.cos(.2 * Math.PI);
            with(context) context.beginPath(),
                context.moveTo(x + 0, y - l * rad1),
                context.lineTo(x + l * rad2, y + 0),
                context.lineTo(x + l + l * rad2, y + 0),
                context.lineTo(x + l * rad2 + 2 * l * rad2 * rad2, y + l * rad3),
                context.lineTo(x + l * rad4, y + 2 * l * rad1 * rad1 - l * rad1 + l * rad3),
                context.lineTo(x + 0, y + 2 * l * rad1 * rad1 - l * rad1),
                context.lineTo(x - l * rad4, y + 2 * l * rad1 * rad1 - l * rad1 + l * rad3),
                context.lineTo(x - l * rad2 - 2 * l * rad2 * rad2, y + l * rad3),
                context.lineTo(x + -l - l * rad2, y + 0),
                context.lineTo(x - l * rad2, y + 0),
                context.lineTo(x + 0, y - l * rad1),
                context.closePath()
        },
        tY: function() {
            return this.Hw && !this.bT.Qr.intersects(this.vt)
        },
        RY: function() {
            var t = this.Hw,
                i = this.rY || t,
                e = this.Ut(),
                s = [t + e, i + e];
            this.vt = new T.ZQ(this.eY.sQ(s), this.eY.AQ(s))
        },
        tY: function() {
            return this.Hw && !this.bT.Qr.intersects(this.vt)
        }
    }),
    T.CloudMarker.prototype.HY = function(t) {
        if (0 == this.options.shape) return t.distanceTo(this.eY) <= this.options.size / 2;
        var i = this.eY,
            e = this.options.size,
            s = t.y + e / 2,
            n = t.y - e / 2,
            o = t.x + e / 2,
            h = t.x - e / 2;
        return n <= i.y && i.y <= s && h <= i.x && i.x <= o
    },
    T.CloudMarkerCollection = T.fT.extend({
        options: {
            fill: !0,
            size: 10,
            color: "#fa937e",
            fillOpacity: .6,
            shape: 0
        },
        initialize: function(t, i) {
            return this.latlngs = t ? t: [],
                T.setOptions(this, i),
                this.checkedOption(),
                T.LayerGroup.prototype.initialize.call(this, i),
                this.options.iW = this.options.iW ? this.options.iW: new T.CanvasMarker,
                this
        },
        checkedOption: function() {
            switch (this.options.ShapeType) {
                case "CIRCLE":
                    this.options.shape = 0;
                    break;
                case "STAR":
                    this.options.shape = 1;
                    break;
                case "SQUARE":
                    this.options.shape = 2;
                    break;
                case "RHOMBUS":
                    this.options.shape = 3;
                    break;
                case "WATERDROP":
                    this.options.shape = 4
            }
            switch (this.options.SizeType) {
                case "TINY":
                    this.options.size = 2;
                    break;
                case "SMALLER":
                    this.options.size = 4;
                    break;
                case "SMALL":
                    this.options.size = 8;
                    break;
                case "NORMAL":
                    this.options.size = 10;
                    break;
                case "BIG":
                    this.options.size = 16;
                    break;
                case "BIGGER":
                    this.options.size = 20;
                    break;
                case "HUGE":
                    this.options.size = 30
            }
        },
        onAdd: function(t) {
            this.update()
        },
        update: function() {
            for (var t = 0; t < this.latlngs.length; t++) this.addLayer(new T.CloudMarker(this.latlngs[t], this.options))
        },
        setLnglats: function(t) {
            this.latlngs = t,
                this.clear(),
                this.update()
        },
        setStyles: function(t) {
            T.setOptions(this, t),
                this.setPoints(this.latlngs)
        },
        clear: function() {
            this.clearLayers(),
                this.options.iW.aY.clearRect(0, 0, this.options.iW.Ow.width, this.options.iW.Ow.height)
        }
    }),
    T.CanvasMarker = T.mT.extend({
        sW: function() {
            var t = this.Ow = document.createElement("canvas");
            T.oq.on(t, "mousemove", T.S.G(this.PY, 32, this), this).on(t, "click", this.pY, this).on(t, "mouseout", this.AY, this),
                this.aY = t.getContext("2d")
        },
        _updatePaths: function(t, i) {
            if (!t.tY()) {
                var e = t.eY,
                    s = this.aY,
                    n = t.Hw;
                this.SY[t.F] = t,
                    i(s, e, n),
                    this.gY(s, t)
            }
        },
        pY: function(t) {
            if (!t._stopped) {
                var i = this.jE.cw(t),
                    e = [];
                for (var s in this.hW) {
                    var n = this.hW[s];
                    n.options.mR && n.HY(i) && (T.oq.hY(t), e.push(n))
                }
                e.sort(function(t, i) {
                    return t.zindex - i.zindex
                }),
                e.length > 0 && this.JY(e, t, t.type)
            }
        },
        jY: function(t, i) {
            var e, s;
            if (!this.KY || this._prehoveredLayer != this.KY) {
                for (e in this.SY) if (s = this.SY[e], s.options.mR && s.HY(i)) {
                    T._Q.Rq(this.Ow, "tdt-interactive"),
                        this._prehoveredLayer = this.KY,
                        this.KY = s,
                    this._prehoveredLayer != this.KY && this.JY([s], t, "mouseover");
                    break
                }
                this.KY && this._prehoveredLayer != this.KY && this.JY([this.KY], t)
            }
        },
        AY: function(t, i) {
            var e = this.KY; ! e || "mouseout" !== t.type && e.HY(i) || (T._Q.Tq(this.Ow, "tdt-interactive"), this.JY([e], t, "mouseout"), this.KY = null)
        },
        JY: function(t, i, e) {
            this.oE(i, e || i.type, [t[0]])
        },
        oE: function(t, i, e) {
            if (!t._stopped && (e = (e || []).concat(this.jE.YE(t, i)), e.length)) {
                var s = e[0];
                "contextmenu" === i && s.EQ(i, !0) && T.oq.preventDefault(t);
                var n = {
                    originalEvent: t
                };
                if ("keypress" !== t.type) {
                    var o = !!s.PE;
                    n.lnglat = o ? s.PE() : this.jE.Dw(n.layerPoint)
                }
                for (var h = 0; h < e.length; h++) if (e[h].wQ(i, n, !0), n.originalEvent._stopped || e[h].options.pE && T.S.indexOf(e[h].options.pE, i) !== -1) return
            }
        }
    }),
    T.GridlineLayer = T.TileLayer.extend({
        options: {
            Te: 256,
            minZoom: 1,
            maxZoom: 18,
            opacity: 1,
            outlineSize: {
                width: 1,
                style: "solid",
                color: "#999"
            },
            textSize: {
                display: !1,
                fontSize: "14",
                fontWeight: !0,
                color: "black"
            }
        },
        setOptions: function(t, i) {
            for (var e in i)"outlineSize" != e && "textSize" != e && (t[e] = i[e]);
            return t
        },
        initialize: function(t) {
            t && t.size && (this.options.Te = t.size),
                this.options.outlineSize = this.setOptions(this.options.outlineSize, t.outlineSize),
                this.options.textSize = this.setOptions(this.options.textSize, t.textSize),
                this.setOptions(this.options, t)
        },
        He: function(t, i) {
            var e = this.options,
                s = e.textSize,
                n = e.outlineSize,
                o = document.createElement("div");
            return s.display && (o.innerHTML = [t.x, t.y, t.z].join(", "), o.style.fontWeight = s.fontWeight ? "bold": "normal", o.style.fontSize = s.fontSize + "px", o.style.color = s.color, o.style.textAlign = "center", o.style.height = e.Te + "px", o.style.width = e.Te + "px", o.style.lineHeight = e.Te + "px", o.style.display = "block", o.style.wordBreak = "keep-all", o.style.whiteSpace = "nowrap", o.style.overflow = "hidden", o.style.textoverflow = "ellipsis"),
                o.style.outline = n.width + "px " + n.style + " " + n.color,
                setTimeout(function() {
                        i(null, o)
                    },
                    50 + 10 * Math.random()),
                o
        }
    }),
    T.PaintBrushTool = T.Tool.extend({
        options: {
            keepdrawing: !0,
            style: {
                color: "blue",
                weight: 10,
                opacity: .5
            }
        },
        initialize: function(t, i) {
            T.setOptions(this, i),
                this.jE = t;
            var e = T.oQ.touch;
            this.mousemove = e ? "touchmove": "mousemove",
                this.mouseFire = e ? "touchend": "mouseup",
                this.mousedown = e ? "touchstart": "mousedown",
                this.layers = new T.LayerGroup,
                this.jE.addLayer(this.layers)
        },
        enable: function() {
            this.eU || (this.eU = !0, this.oU())
        },
        disable: function() {
            this.eU && (this.eU = !1, this.Ar())
        },
        open: function() {
            this.enable()
        },
        close: function() {
            this.disable()
        },
        getLayers: function() {
            return this.layers.getLayers()
        },
        clear: function() {
            this.layers.clearLayers()
        },
        oU: function() {
            this.jE && (this.jE.disableDrag(), this.Ow = this.jE.getContainer(), this.jE.on(this.mousemove, this.bs, this), this.jE.on(this.mousedown, this.Ms, this), T.oq.on(document, this.mouseFire, this.ns, this), T._Q.Oq(), this.jE.getContainer().style.cursor = "crosshair")
        },
        Ar: function() {
            this.jE && (this.jE.enableDrag(), this.jE.off(this.mousemove, this.bs, this), this.jE.off(this.mousedown, this.Ms, this), T._Q.Pq(), T.oq.on(document, this.mouseFire, this.ns, this), this.jE.getContainer().style.cursor = "")
        },
        bs: function(t) {
            if (this.DragLayer) {
                var i = t.lnglat,
                    e = this.DragLayer.getLngLats();
                e.push(i),
                    this.DragLayer.setLngLats(e),
                    this.jE.getContainer().style.cursor = "pointer"
            }
        },
        Ms: function(t) {
            this.DragLayer = new T.Polyline([], this.options.style),
                this.layers.addLayer(this.DragLayer)
        },
        ns: function(t) {
            this.DragLayer && (this.DragLayer = null, this.jE.getContainer().style.cursor = "crosshair", this.options.keepdrawing || this.disable())
        }
    });
